NEW YORK (Reuters) - The three major U.S. stock indexes closed higher on Monday as investors applauded a strong U.S. earnings season with results from Berkshire Hathaway impressing and Facebook lifting Nasdaq after a report it was planning new services.

The S&P edged closer to a record hit on Jan. 26, closing within a percentage point of the all-time high for the first time since the current correction began.

Investors were focused on robust corporate earnings and shrugged off worries about U.S. tensions with countries including China and Iran.

“The earnings news has been powerful and it’s allowed investors to focus on what’s most important but with earnings winding down then investors tend to react to the latest shiny object or geopolitical news headline,” said Jack Ablin, chief investment officer at Cresset Wealth Advisors in Chicago.

For example Ablin said U.S. President Donald Trump’s stand-off with Iran could put pressure on stocks.

Iranian President Hassan Rouhani dismissed a U.S. call for talks on Monday, hours before Washington was due to impose new sanctions following Trump’s decision to pull out of a 2015 agreement over Iran’s nuclear program.

Also Kristina Hooper, global market strategist at Invesco in New York, said there were some signs China is “hunkering down and getting ready for a significant trade war” and that the impact “could be more far-reaching than previously assumed.”

Chinese state media on Monday lambasted U.S. President Donald Trump’s trade policies in an unusually personal attack, and sought to reassure investors anxious about China’s economy as growth concerns battered its financial markets.

The Dow Jones Industrial Average rose 39.6 points, or 0.16 percent, to 25,502.18, the S&P 500 gained 10.05 points, or 0.35 percent, to 2,850.4 and the Nasdaq Composite added 47.66 points, or 0.61 percent, to 7,859.68.

The Cboe Volatility Index, the most widely followed barometer of expected near-term gyrations for the S&P 500, closed down 0.37 point at 11.27, its lowest close since late January.

Nine of the S&P’s 11 major industry sectors advanced, with the technology index, which rose 0.6 percent and the financial sector, which gained 0.4 percent, providing the biggest boosts to the benchmark.

Of the 413 S&P 500 companies that have reported second-quarter results so far, 79.2 percent have topped earnings estimates, according to Thomson Reuters data. That compares with the 72 percent average for the past four quarters.

“We still have a good amount of positive sentiment coming from a strong earnings season. ... That’s certainly providing a significant amount of positive force to stocks today,” said Invesco’s Hooper.

A trader works on the floor of the New York Stock Exchange shortly after the opening bell in New York, U.S., July 31, 2018. REUTERS/Lucas Jackson

The finance sector’s biggest contributor was Berkshire Hathaway Inc, which rose 2.3 percent after the Warren Buffett-led conglomerate reported a 67 percent surge in quarterly operating profit.

Technology’s biggest boost came from Facebook, which gained 4.4 percent after the Wall Street Journal reported it had asked large U.S. banks to share detailed financial information about customers as part of an effort to offer new services.

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

The S&P 500 posted 22 new 52-week highs and two new lows; the Nasdaq Composite recorded 83 new highs and 76 new lows.

Volume on U.S. exchanges was 5.95 billion shares, compared to the 6.29 billion average for the last 20 trading days.