By Sinead Carew

(Reuters) - U.S. stocks rose on Tuesday, with the Dow registering its fourth consecutive record high close as tech stocks rebounded from a post-election battering and energy stocks were boosted by a sharp rise in oil prices.

The Dow Jones industrial average extended its rally to seven days after it turned positive in late trading, while oil futures continued their rise and investors kept piling into technology stocks.

"Buyers who were waiting to buy technology stocks didn't have an option but to get involved and continue buying the strength. That's propelled them higher as the day went on," said Michael James, managing director of equity trading at Wedbush Securities in Los Angeles.

The technology sector was the S&P's biggest gainer, closing up 1.3 percent in a partial rebound from its 3 percent decline since Donald Trump's shock victory on Nov. 8. Investors set aside worries that the sector could be hurt by Trump's immigration and foreign trade policies.

The S&P's energy index was the next biggest driver, with a 2.7 percent rise, as U.S. crude oil jumped more than 6 percent from multi-month lows on expectations that OPEC will agree later this month to cut production..

The Dow Jones industrial average rose 54.37 points, or 0.29 percent, to 18,923.06, the S&P 500 gained 16.19 points, or 0.75 percent, to 2,180.39 and the Nasdaq Composite added 57.23 points, or 1.1 percent, to 5,275.62.

Tech giants Microsoft, Amazon and Alphabet provided the biggest boost to the Nasdaq, and along with Apple Inc, were the top drivers for the S&P 500.

Oil giant Exxon Mobil rose 1.8 percent, also contributing to the S&P's rise.

Equity investors have been betting that Donald Trump will live up to his campaign promises to boost government spending, along with lower taxes and lighter regulation.

"People view all of this as positive for the economy and positive for the market. That continues to wash through the market. The buying isn't as virulent as it was, but we're still doing well," said Stephen Massocca, chief investment officer at Wedbush Equity Management LLC in San Francisco.

High-dividend-paying sectors such as utilities and telecommunications also rose following a steep sell-off in the past few days.

U.S. retail sales rose more than expected in October as households bought motor vehicles and a range of other goods. The Commerce Department said on Tuesday that retail sales increased 0.8 percent last month, above the 0.6 percent increase forecast by economists.

Home Depot fell 2.6 percent to $124.40 after the No. 1 U.S. home improvement chain reported strong third-quarter results but kept its full-year sales forecast, implying a weaker-than-expected fourth quarter.

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

The S&P 500 posted 37 new 52-week highs and 3 new lows; the Nasdaq Composite recorded 173 new highs and 32 new lows.

About 8.4 billion stocks changed hands on U.S. exchanges, lighter than Monday's volume but well above the 7.8 billion average for the last 20 sessions.

(Additional reporting by Tanya Agrawal and Anya George Tharakan; Editing by Saumyadeb Chakrabarty and Dan Grebler)