NEW YORK (Reuters) - U.S. stocks ended slightly higher on Tuesday, with the S&P 500 inching closer to its all-time high following a string of mostly positive earnings, while a drop in healthcare shares limited the advance.

All three major U.S. stock indexes ended the session in positive territory, with the S&P 500 hovering within a percentage of its record high reached in September.

Bank of America Corp, Johnson & Johnson, BlackRock Inc, UnitedHealth Group Inc and others posted quarterly earnings that surpassed analyst expectations.

But stock movements following the reports were mixed.

“You see different numbers and different drivers,” said John Lynch, chief investment strategist for LPL Financial in Charlotte, North Carolina. “We’ve had some mixed messages from financials and healthcare.”

With reporting season in full swing, analysts now expect first quarter S&P 500 profits to have dropped 1.8% year-on-year, according to Refinitiv data. While a solid improvement over recent estimates, it would still mark the first earnings decline since 2016.

Of the 42 S&P 500 companies that have posted thus far, 81% have beaten consensus, compared with the 65% average beat rate going back to 1994.

Johnson & Johnson came in above analyst estimates, mostly attributable to sales growth at its pharmaceuticals unit, driving the stock 1.1% higher.

But UnitedHealth Group, which also reported better-than-anticipated first-quarter profit and hiked its 2019 earnings forecast, fell 4.0%, likely due to regulatory worries. The stock was the biggest drag on the Dow.

FILE PHOTO: Traders work on the floor at the New York Stock Exchange (NYSE) in New York, U.S., April 8, 2019. REUTERS/Brendan McDermid

Rivals Anthem Inc and Cigna Corp also slid, dropping 6.8% and 7.8%, respectively.

The S&P 500 Healthcare Index closed down 2.0%

The second biggest U.S. bank by assets, Bank of America missed revenue expectations but its profit beat forecasts due to cost cutting and loan increases. Its shares edged up 0.1%.

BlackRock, the world’s largest asset manager, gained 3.2% after blowing past Street expectations and raking in $65 billion in new investor cash in the first quarter.

The Dow Jones Industrial Average rose 67.89 points, or 0.26%, to 26,452.66, the S&P 500 gained 1.48 points, or 0.05%, to 2,907.06 and the Nasdaq Composite added 24.21 points, or 0.3%, to 8,000.23.

Of the 11 major sectors in the S&P 500, seven ended the session in the black.

Financials were the biggest percentage winners, rising 1.4%.

Streaming company Netflix Inc dipped in after-hours trading after it posted first quarter results.

International Business Machines Corp also fell post-market following the blue-chip tech company’s earnings report.

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

The S&P 500 posted 57 new 52-week highs and 6 new lows; the Nasdaq Composite recorded 96 new highs and 41 new lows.

Volume on U.S. exchanges was 6.57 billion shares, compared to the 6.87 billion average over the last 20 trading days.