NEW YORK (Reuters) - U.S. stocks rose on Tuesday as Apple led a jump in technology shares and a gain of more than 2 percent in oil prices drove up energy shares.

Apple rose 2.5 percent, boosting the three major indexes, a day ahead of its expected unveiling of new iPhone models.

The S&P technology sector gained 0.8 percent, its biggest percentage jump in two weeks, also boosted by Microsoft, up 1.7 percent, and Facebook, up 1.1 percent.

“That’s been the main fuel for the market,” said Alan Lancz, president of Alan B. Lancz & Associates Inc, an investment advisory firm based in Toledo, Ohio. “Maybe tech has taken the punch and is recovering, and investors are getting more confident that the leader is back.”

The technology sector is up close to 18 percent for the year so far, leading sector gains in the S&P 500 along with consumer discretionary, also up roughly 18 percent since Dec. 31.

The energy index, up 1 percent, helped to lift the S&P 500, with shares of Exxon Mobil up 1.4 percent and Chevron up 0.5 percent. Oil prices rose after U.S. sanctions squeezed Iranian crude exports and tightened global supply.

The Dow Jones Industrial Average rose 113.99 points, or 0.44 percent, to 25,971.06, the S&P 500 gained 10.76 points, or 0.37 percent, to 2,887.89 and the Nasdaq Composite added 48.31 points, or 0.61 percent, to 7,972.47.

Slideshow ( 4 images )

Also gaining were shares of companies that could see a boost in sales in the aftermath of Hurricane Florence, which was upgraded to Category 4 and was expected to make landfall in the Carolinas later this week.

Home improvement retailer Home Depot was up 1.5 percent and Lowe’s Companies was up 1.6 percent, while shares of construction material companies also rose.

The gains came despite lingering trade tensions. China told the World Trade Organization it wanted to impose sanctions on the United States for its non-compliance with a ruling in a dispute over U.S. dumping duties.

President Donald Trump had on Friday threatened to slap tariffs on nearly all Chinese imports.

Western Digital slid 3.6 percent after RBC echoed other brokerages in warning that falling NAND chip prices would hit the company.

Activision Blizzard jumped 7.1 percent and Take-Two Interactive Software gained 3.7 percent after brokerage Stifel forecast a strong reception for their videogames in the holiday period.

Advancing issues outnumbered declining ones on the NYSE by a 1.06-to-1 ratio; on Nasdaq, a 1.15-to-1 ratio favored decliners.

The S&P 500 posted 37 new 52-week highs and 14 new lows; the Nasdaq Composite recorded 106 new highs and 98 new lows.

About 6.3 billion shares changed hands on U.S. exchanges. That compares with the 6.1 billion daily average for the past 20 trading days, according to Thomson Reuters data.