NEW YORK (Reuters) - The S&P 500 index and the Nasdaq registered record closing highs after a broadbased rally on Tuesday, as a clutch of better-than-expected earnings reports eased concerns about a slowdown.

In Tuesday’s trading the benchmark index finally erased all the steep losses it saw in late 2018 by ending the day above the previous record reached on Sept. 20. It closed just 0.3% below its intra-day record of 2,940.91 hit on Sept. 21.

The S&P has risen 17 percent so far this year, with help from a dovish Federal Reserve and hopes of a U.S.-China trade resolution as well as the upbeat start to the first-quarter earnings season.

“Part of what’s pushing the S&P up is a general belief it will make a new high,” said Rick Meckler of Cherry Lane Investments, a family investment office in New Vernon, New Jersey, who expects that more earnings reports later in the week could push the index above its all-time high.

The diversity of industry sectors reporting strong results on Tuesday gave further reassurance to Tony Roth, chief investment officer at Wilmington Trust in Wilmington, Delaware, who expects the trend to continue.

“Today was a very broadly representative day of the overall economy. That’s what’s driving the markets,” said Roth citing results from United Technologies Corp, Lockheed Martin Corp and Coca-Cola Co.

“If the earnings season is as strong as we expect the next major signpost is the trade situation with China and getting that resolved,” said Roth.

The Dow Jones Industrial Average rose 145.34 points, or 0.55%, to 26,656.39, the S&P 500 gained 25.71 points, or 0.88%, to 2,933.68 and the Nasdaq Composite added 105.56 points, or 1.32%, to 8,120.82.

Profits of S&P 500 companies are still expected to decline 1.3% in the first quarter, in what analysts say could be the first earnings contraction since 2016. However, forecasts have largely improved since the start of April.

Slideshow ( 3 images )

Amazon.com Inc, set to report results later this week, gained 2.2%, providing the biggest boost to the S&P 500 and the Nasdaq.

Ten of the 11 major S&P sectors were higher, with a rebound in healthcare, which gained 1.6%, providing the biggest boost. The healthcare sector has been slammed with 6.7% drop in the last two weeks on U.S. policy concerns.

“People just realized (healthcare) got beaten so far down it might be worth taking a chance,” said Robert Pavlik, chief investment strategist and senior portfolio manager at SlateStone Wealth LLC in New York.

The consumer staples sector was the only S&P sector that ended the day lower as investors favored riskier bets. The energy and utilities sectors were the next weakest performers on the day.

Twitter Inc shares soared 15.6% after the social media company posted better-than-expected quarterly revenue and a surprise increase in monthly active users.

Hasbro Inc rose 14.2% after the toymaker reported a surprise quarterly profit.

Coca-Cola rose 1.7% after its quarterly sales beat estimates, helped in part by strong demand for Coke Zero.

Lockheed Martin jumped 5.7% after it reported upbeat quarterly results and lifted its full-year profit forecast on strong demand for its missiles and fighter jets.

Slideshow ( 3 images )

United Technologies rose 2.3% after it raised its full-year profit forecast.

Procter & Gamble Co fell 2.6% and was the biggest drag on the market after reporting a decline in its third-quarter operating margin.

Advancing issues outnumbered declining ones on the NYSE by a 2.91-to-1 ratio; on Nasdaq, a 2.82-to-1 ratio favored advancers.

The S&P 500 posted 47 new 52-week highs and four new lows; the Nasdaq Composite recorded 80 new highs and 45 new lows.

On U.S. exchanges was 6.75 billion shares changed hands, compared with the 6.64 billion average for the full session over the last 20 trading days.