The gains come a day after the major indexes posted their biggest daily percentage increases in nearly a decade, feeding some hope that a Wall Street swoon may be coming to an end. The S&P 500's two-day percentage gain of 5.9 percent is the best performance for the benchmark index since late August 2015 when the market was in the midst of a downturn over a slowing China.
Even so, all three major indexes remain down more than 9 percent for December. The S&P 500 is on track for its biggest annual percentage drop since 2008.
Stocks were lower for most of Thursday's session, with the S&P 500 dropping as much as 2.8 percent. Strategists said such a pullback was to be expected following the huge jump on Wednesday, when the Dow Jones Industrial Average rose 1,000 points for the first time.
Losses on Thursday reversed in the last hour of trading, with stocks almost across the board churning higher. All 11 sectors finished in positive territory.
"I just think that the selling has been exhausted in the near term. When yesterday's rally only retraced a portion this morning, buyers came back in at the end of the day," said Rick Meckler, partner at Cherry Lane Investments, in New Vernon, New Jersey. "The general feeling is that a near-term bottom has been put in."
The Dow Jones Industrial Average .DJI rose 260.37 points, or 1.14 percent, to 23,138.82, the S&P 500 .SPX gained 21.13 points, or 0.86 percent, to 2,488.83 and the Nasdaq Composite .IXIC added 25.14 points, or 0.38 percent, to 6,579.49.