The S&P 500 energy sector surged more than 4 percent on Wednesday after Reuters reported that OPEC reached a deal that would limit its oil production to 32.5 million barrels per day.
The sector had its best daily performance since Jan. 22 when it gained 4.3 percent.
U.S. West Texas Intermediate crude futures contracts settled up 5.33 percent at $47.05 a barrel on Wednesday, their best day since April 8. Brent crude futures hit a high of $48.96 per barrel.
Best performers in the sector included Devon Energy, Marathon Oil and Helmerich & Payne, which gained about 8.3 percent, 8 percent and 7.7 percent, respectively.
Big oil companies like ExxonMobil and Chevron also climbed more than 4 percent and 3 percent, respectively.
The energy sector is up more than 14 percent so far this year.
— CNBC's Robert Hum, Bob Pisani and Gina Francolla contributed to this report.