(Reuters) - Wall Street climbed on Monday, boosted by Apple’s sixth straight day of gains and by a surge in oil prices to their highest since 2014.

The S&P energy index ended 0.18 percent higher, although it surrendered earlier stronger gains after U.S. President Donald Trump tweeted that on Tuesday he would announce his decision on whether to withdraw from the Iran nuclear deal.

Trump has threatened to withdraw from the agreement, which provided Iran with relief from sanctions in exchange for limiting its uranium enrichment capacity, unless European signatories to the accord fix what he has called its shortcomings.

Energy stocks rallied earlier in the session due to troubles for Venezuelan oil company PDVSA and by the looming decision on whether the United States will re-impose sanctions on Iran. [O/R]

“Oil has done well in anticipation of the announcement from Trump. People are braced for the worst,” said Keith Lerner, chief market strategist at SunTrust Advisory Services in Atlanta.

Apple added 0.72 percent, extending gains since it reported results last week and after Berkshire Hathaway on Friday disclosed it had boosted its stake in the iPhone maker. Warren Buffett told CNBC on Monday, “I’d love to own 100 percent of it.”

“Buffet took such an outsized position in Apple, which was reassuring to a lot of people,” said Jack Ablin, Chief Investment Officer at Cresset Wealth Advisors in Chicago. “Psychologically, people went into last week a little skeptical, but I think we saw a thawing of that late last week and over the weekend.”

Trader Michael Capolino shouts out a bid on the floor of the New York Stock Exchange (NYSE) in New York, U.S., May 3, 2018. REUTERS/Brendan McDermid

Worries over inflation and interest rates, along with tariff and geopolitical tensions, have overshadowed a solid earnings season, which is on track to record its best quarter in seven years.

Nearly 80 percent of the 417 S&P 500 companies that have reported so far have topped profit estimates, according to Thomson Reuters I/B/E/S. That is well above the long-term average of 64 percent and the average of 75 percent over the past four quarters.

Three quarters of companies have reported revenue above expectations, compared to 60 percent in a typical quarter. That suggests that companies are growing their businesses, and not solely benefiting from deep corporate tax cuts introduced this year.

The Dow Jones Industrial Average rose 0.39 percent to end at 24,357.32, while the S&P 500 gained 0.35 percent to 2,672.63. Earlier, the S&P 500 was up as much as 0.75 percent.

The Nasdaq Composite added 0.77 percent to 7,265.21.

Seven of the 11 major S&P sectors rose, with the technology index climbing 0.79 percent.

AthenaHealth jumped 16.39 percent after hedge fund Elliott Management proposed an all-cash offer that would value the healthcare IT company at about $6.5 billion.

Utilities, healthcare consumer staples and telecoms all declined.

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

The S&P 500 posted 25 new 52-week highs and seven new lows; the Nasdaq Composite recorded 124 new highs and 23 new lows.

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