The Standard & Poor’s 500-stock index and the Nasdaq composite broke through previous all-time closing highs in afternoon trading. (Brendan Mcdermid/Reuters)

Stocks closed at new highs Tuesday following a raft of corporate earnings that beat expectations and renewed optimism that the 10-year bull market has strength to grow.

The Standard & Poor’s ­500-stock index and the Nasdaq composite index breached new closing highs. The Dow Jones industrial average finished just short of an all-time high.

The S&P 500 closed at 2,933, beating its previous closing high of 2,930 from Sept. 20. The tech-heavy Nasdaq closed at 8,120, up 1.3 percent, eclipsing its previous record close of 8,109 on Aug. 29.

The Dow finished the day at 26,656, up 145, or 0.55 percent. It is still 172 points — or 0.64 percent — below its all-time close of 26,828 on Oct. 3, 2018.

Tuesday’s gains marked a big comeback for stocks after a disappointing 2018. The Dow fell 5.6 percent last year. The S&P dropped 6.2 percent and the Nasdaq fell 4 percent on worries of a global slowdown.

Low interest rates, negligible inflation, record employment and reverberations from last year’s corporate tax cut are powering the U.S. economy and its stocks.

“You had 50 or so earnings announcements today, and all of them were very good,” said Kenny Polcari of Butcher Joseph Asset Management. “Today’s market is more about the forward guidance showing an improving economy going forward. It continues to be the theme. Three months ago they were talking about recession and poor guidance, and that has not been the case at all.”

Tuesday’s pop came across a broad range of industries amid the busiest earnings week of the year. Nearly a third of all S&P companies report financial results this week. Ten of 11 stock sectors Tuesday closed in positive territory, led by health care, consumer staples and real estate. Consumer discretionary was the only industry in the red.

As of the close Tuesday, 79 of 102 companies reporting first-quarter results had beaten expectations, according to Howard Silverblatt of S&P Dow Jones Indices. Sixteen missed estimates, and seven met projections.

The S&P has risen 24.69 percent from its low on Dec. 24, 2018, Silverblatt said.

The Dow was close behind the other two major indexes, with 22 of 30 companies advancing. Four members — Coca Cola, United Technologies, Verizon and Procter & Gamble — reported earnings Tuesday that came in better than expected. The big surprise was the forecasts for sales strength in some of those issues.

“The market recovery from the downturn at the end of last year is now complete,” said Brad McMillan, chief investment officer for Commonwealth Financial Network. “For all the worries about growth and corporate earnings, both seem to be beating expectations.”

Oil markets were up, too, reaching recent highs on the news that the Trump administration is rescinding exemptions that had allowed several countries to buy Iranian oil. The White House is reimposing sanctions against Iran beginning in early May. The move is expected to tighten global oil supplies.

Benchmark Brent crude oil was trading at $74.54 a barrel Tuesday, up 0.68 percent on the day. U.S. West Texas Intermediate was selling at $66.33, up more than a full percentage point. Both of those numbers are the highest prices in about five months.

All three major indexes are having a strong year. The S&P 500 is up 17 percent. The Nasdaq is up 22 percent, thanks to a big comeback this year from the so-called FANG stocks: Facebook, Amazon, Netflix and Google-parent Alphabet. Microsoft and Apple are also in the FANG mix. Most of the FANG was up more than 1 percent Tuesday.

The Dow has surged 14 percent in 2019. Consumer goods giant Procter & Gamble, a key measure of U.S. economic health, predicted strong growth in the United States, and in China higher sales for this year. The Nasdaq was powered, in part, by Twitter, whose stock jumped more than 15 percent. The social media company crushed forecasts, reporting 37 cents earnings per share versus 15 cents analysts had predicted.

“The most compelling thing is that companies are raising guidance,” said Nancy Tengler of Tengler Wealth Management. “They didn’t expect companies like Coke, P&G and UTX to generate organic growth in the mid- to high- single digits. It tells me that China growth is reaccelerating. That’s good for global growth.”

Other analysts cautioned against getting too excited over Tuesday’s market.

“Earnings season is not over and we can just as easily see some earnings disappointments in coming days,” said Kristina Hooper, chief global market strategist at Invesco. “Or we could see some negative developments in the ongoing trade situation. We will probably see a pullback in coming months. All in all, I expect the S&P 500 to end the year modestly above where it is today.”