This story was updated at 4:15 p.m. EDT.
A surge in crude oil drove strong gains on Wall Street on Tuesday after a report that Russia and Saudi Arabia had agreed to freeze output ahead of a producers meeting on Sunday.
Oil prices rose more than 3 percent to their highest in five months after Russia's Interfax news agency also reported that the final decision to freeze production will not depend on Iran.
The S&P energy sector rose sharply, leading all 10 major sectors higher. Chevron was up 2 percent to $97.51 and gave the biggest boost to the Dow.
"We have oil cooperating with the bulls today," said Andre Bakhos, managing director at Janlyn Capital in Bernardsville, New Jersey.
Bakhos added the U.S. earnings season would set the tone for the stock market going forward for the next quarter of trading.
However, Alcoa's lackluster first-quarter report marked a dull start to the season. The company's shares were down 3 percent at $9.48.
Investors will focus on corporate earnings over the next several weeks, amid turbulent global markets and uncertainty surrounding the U.S. Federal Reserve's plan to raise interest rates.
S&P 500 companies are expected to post a decline of 7.8 percent in profit on average for the latest quarter, according to Thomson Reuters I/B/E/S.
The S&P 500 index has risen more than 12 percent from its low in February as oil rebounded and data suggested that the U.S. economy was recovering.
Still, global risks remain a concern. The International Monetary Fund cut its global growth forecast for the fourth time in the past year on Tuesday, citing China's slowdown and chronic weakness in advanced economies.
The Dow Jones Industrial Average closed the day up 165 points, or 1 percent, at 17,721, and the S&P 500 was up 20 points, or 1 percent, at 2,062. The Nasdaq Composite rallied 39 points, or 1 percent, to 4,872.
Juniper Networks sank 7 percent to $23.06 after the company estimated quarterly profit and revenue below analysts' expectations.
Starbucks fell 2 percent to $59.50 after Deutsche Bank downgraded the stock to "hold" from "buy."