Wall Street traders
Traders and financial professionals on the floor of the New York Stock Exchange (NYSE). Norway's sovereign wealth fund lost a ton of money at Wall Street and other equity markets in 2018. JOHANNES EISELE/AFP/Getty Images

The S&P 500 and the Nasdaq Composite posted record closing highs Tuesday after a wide-ranging rally after a string of better-than-expected earnings reports tamped-down concerns about an economic slowdown.

The broad index closed 0.9 percent higher at 2,933.68, topping its previous record close of 2,930.75. The S&P 500 ended the day up 0.88 percent, or 25.69 points, to reach 2,933.66, which is just below its intraday record of 2,940.91.

The Nasdaq finished up 1.3 percent at 8,120, closing above its Aug. 29, 2018 all-time closing high of 8,109.69. The Dow Jones Industrial Average gained 0.6 percent to end at 26,656, just 1.1 percent shy of its Oct. 3, 2018 record at 26,828.39.

Tuesday’s cheery results are in sharp contrast to the gloom pervading Wall Street after a stunning decline in late December saw the S&P 500 sink to its worst annual performance since 2008. Analysts said the event that turned things around was the action taken by the Federal Reserve in March announcing no more interest rate hikes this year. Optimistic news from the U.S.-China trade talks, while hazy, also played a role in boosting investor morale.

“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.”

Analysts also said corporate earnings results made public so far have mostly beaten expectations. More than 78 percent of the S&P 500 companies that have reported exceeded analyst expectations, according to FactSet data. By the end of this earnings season, more than 140 S&P 500 companies will have released their calendar first-quarter results.

“Among the key companies that have reported, most of them have beaten expectations,” said Peter Cardillo, chief market economist at Spartan Capital Securities. “That means we’re probably going to escape an earnings recession. That will be key for the market to rally from here.”

Dow stalwarts Coca-Cola and United Technologies saw their shares rise 1.7 percent and 2.3 percent, respectively, after revealing better-than-expected quarterly earnings. Defense giant Lockheed Martin rallied more than 5 percent after its earnings easily topped expectations. It reported strong operating margins across all its major businesses.

Coty rose 7.2 percent, the largest on the S&P, while Estee Lauder gained 2 percent after Morgan Stanley upgraded the shares of the beauty products makers.

Xilinx gained 2.9 percent to lead gainers on the Nasdaq 100 after Baird upgraded the chipmaker’s shares on a expected boost in 5G-related shipments later this year. Procter & Gamble posted stronger-than-forecast earnings, but its stock closed down 2.7 percent.