Stocks rose to close out their best January in three decades as strong earnings and a Federal Reserve indicating it will pause rate hikes caused investors to rush back into the market following a vicious December sell-off.

The gain on Thursday was driven by better-than-expected earnings from a range of companies, including Facebook and General Electric. The gained 0.9 percent to close at 2,704.10 and the Nasdaq Composite outperformed, rising 1.37 percent to 7,281.74. The Dow Jones Industrial Average closed just below the flatline at 24,999.67.

The S&P 500 jumped 7.87 percent this month, its best January performance since 1987, and its biggest monthly gain since October 2015. The Dow rose 7.17 percent in January, its largest one-month rise since 2015 and biggest January gain in 30 years.

Shares of Facebook surged 10.8 percent after the company's quarterly results easily topped expectations. GE shares jumped 11.65 percent on stronger-than-forecast revenue. These results come during the busiest week of the corporate earnings season.

"We're close to fair value," said Dave Lafferty, chief market strategist at Natixis Investment Managers. "It feels like a lot of this was a pop from fairly oversold levels in the fourth quarter. The market sort of ran away with itself to the downside and it's come back."

Last month, the S&P 500 fell 9.18 percent and briefly dipped into bear-market territory on an intraday basis on Christmas Eve. Since Dec. 24, however, stocks have been on a tear, with the S&P 500 rising about 15 percent.

The market is now "thinking about what is the next catalyst," Lafferty of Natixis said. "It doesn't feel, to me, like this pop in January is the beginning of a big new move. It feels like it was just a rebound from oversold levels."

The market got a boost in the final minutes of trading Thursday after President Donald Trump told reporters in the Oval Office he hoped to strike a deal with China before the march deadline. A translator also presented Trump with an optimistic letter from Chinese President Xi Jinping.

Other companies that reported better-than-expected earnings on Thursday included UPS, which rose 4.16 percent. Charter Communications, meanwhile, rose more than 14 percent after reporting better-than-expected quarterly sales.