HOUSTON (Reuters) - Oil prices rose to the fourth consecutive weekly gain on Friday, steadying at three-month highs after new data showed U.S. crude inventories fell far more than expected, while upbeat economic data and optimism over a U.S.-China trade deal fueled a year-end stock market rally.

FILE PHOTO: Pumpjacks are seen during sunset at the Daqing oil field in Heilongjiang province, China August 22, 2019. REUTERS/Stringer

Brent crude LCOc1 rose 24 cents to settle at $68.16 a barrel, the highest since mid-September. The international benchmark has climbed nearly 27% since the end of 2018.

West Texas Intermediate CLc1 rose 4 cents to settle at $61.72 a barrel, another three-month high. The U.S. benchmark has risen 36% so far this year.

U.S. crude stocks fell by 5.5 million barrels in the week to Dec. 20 to 441.4 million barrels, according to the Energy Information Administration, far exceeding analysts’ expectations of a 1.7 million-barrel drop.

“Inventories are bullish almost across the board,” said Josh Graves, senior market strategist at RJO Futures in Chicago.

A year-end stock market rally also helped lift oil prices as consumer sentiment continued to improve, he said.

“It’s a Santa Claus rally. People tend to buy more things that will indirectly drive the price of oil up,” Graves said.

U.S. stock indexes rose slightly on Friday, with the S&P 500 index .SPX close to logging its best year since 1997. The Nasdaq .IXIC crossed the 9,000 point mark for the first time on Thursday.

U.S. energy firms idled eight working oil rigs, the first reduction in three weeks, as producers followed through on plans to slash spending, energy services firm Baker Hughes Co BRK.N said in its closely followed report on Friday.

Oil trade was thin. But oil-market sentiment improved as new data showed profits at China’s industrial firms rose at the fastest pace in eight months in November, according to the National Bureau of Statistics.

In the United States, a survey showed on Thursday online holiday purchases by U.S. consumers reached a record, beating analysts’ expectations and lifting U.S. stocks to fresh highs.

China and the United States cooled their 17-month trade war earlier this month, announcing a Phase 1 agreement that would reduce some U.S. tariffs.

The Organization of the Petroleum Exporting Countries and its allies including Russia, known as OPEC+, this month decided to prolong an oil output restriction deal until the end of March and to deepen the cuts in order to balance out the oil market.

But OPEC+ may consider wrapping up their oil output reduction in 2020, Russian Energy Minister Alexander Novak said on Friday.