The and Nasdaq Composite rallied on Tuesday to notch record closing highs as Wall Street cheered stronger-than-expected quarterly profits from some of the largest publicly traded U.S. companies.

The broad index closed 0.9% higher at 2,933.68, topping its previous record close of 2,930.75. The S&P 500 also ended the day just below its intraday record of 2,940.91. The Nasdaq closed up 1.3% at 8,120.82. The Dow Jones Industrial Average, meanwhile, gained 145.34 points to close at 26,656.39 and was 1.1% from an all-time high.

Tuesday's move toward an all-time closing high comes less than six months after a sharp decline in late December, which led the S&P 500 to its worst annual performance since 2008. But stocks quickly turned around as the Federal Reserve reversed course on monetary policy while the tone around U.S.-China trade talks improved.

"These market levels are justified," said Kevin Barry, chief investment officer at Captrust Advisors. "The fourth-quarter sell-off actually prevented a recession because policymakers responded extremely quickly. Both President Xi and President Trump cooled off the rhetoric and Fed Chairman Jerome Powell came out and reversed course."

Dow members Coca-Cola and United Technologies reported better-than-expected quarterly earnings on Tuesday. Their shares rose 1.7% and 2.3%, respectively.

Twitter shares jumped 15.6% on its stronger-than-expected results. The social media company said its monthly active users totaled 330 million, more than a FactSet estimate of 318 million.