The price of oil jumped almost 6 percent Wednesday following a drop in crude inventories last week that was much steeper than analysts were expecting.
Chevron and Exxon Mobil were among the biggest gainers in the Dow Jones industrial average.
Anheuser-Busch InBev jumped 7 percent after the company made a takeover approach to SABMiller, the owner of Miller and Peroni. Other beer makers also rose.
The Dow gained 140 points, or 0.8 percent, to close at 16,739.
The Standard & Poor's 500 rose 17 points, or 0.9 percent, to 1,995. The Nasdaq composite climbed 28 points, or 0.5 percent, to 4,889.
The yield on the 10-year Treasury note held steady at 2.29 percent.