Oil rose above $79 a barrel on Tuesday after five sessions of losses as gains in the U.S. stock market boosted prices, outweighing earlier pressure from mild weather and the stronger greenback.

U.S. crude settled at $79.02 a barrel, up $1.02 from Friday's settlement. The New York Mercantile Exchange was closed on Monday for the Martin Luther King Day holiday.

Brent crude rose 53 cents to $77.63 a barrel.

I do think the S&P 500 is the market's excuse for price recovery. Whether that establishes that the S&P trumps the stronger dollar and the direct fundamentals remains to be seen, said Tim Evans, energy analyst at Citi Futures Perspective in New York.

Wall Street gains boosted crude prices as investors bet a Massachusetts Senate race could derail President Obama's healthcare reform plan, which had been seen as a threat to profits in the key sector. The Dow Jones industrial average <.DJI> rose more than 1 percent. <.N>

Opinion polls showed that Massachusetts voters may replace the late Senator Edward Kennedy with a Republican, taking away the Democrats' 60-vote supermajority in the U.S. Senate.


However, high oil inventories and weaker demand due to mild winter weather were still a factor for oil prices, analysts said.

U.S. heating fuel demand is expected to be well below normal this week, according to the National Weather Service.

A Reuters poll of analysts showed that U.S. crude oil inventories likely rose last week, adding to already high inventories, as refinery utilization fell and imports increased.

The Organization of the Petroleum Exporting Countries (OPEC) said oil inventories are high enough to absorb any increase in winter fuel demand.

The group also cut its forecast for demand for its crude by 20,000 barrels per day to 28.59 million bpd in its monthly report, while leaving its forecast for world oil demand growth unchanged at 820,000 bpd.

A stronger dollar may also add some pressure to oil prices, with the euro falling to a four-week low against the dollar.

A rise in the value of the dollar often discourages investor interest in dollar-denominated commodities such as oil.

(Additional reporting by Robert Gibbons and Gene Ramos in New York, Ikuko Kao in London, Alejandro Barbajosa in Singapore; Editing by David Gregorio)