Oil prices rose on Wednesday as investors covered short positions when a big rise in U.S crude inventories was not as massive as many had feared, and as gasoline futures got a boost from a surprise decline in inventories of the fuel.
U.S. crude stocks rose 13.8 million barrels in the last week as refineries cut output, while gasoline stocks decreased, the Energy Information Administration said. The rise did not shock the market, since preliminary data from the American Petroleum Institute (API) late on Tuesday showed an even bigger increase.
"A lot of the downside was already priced in," said Rob Haworth, senior investment strategist at U.S. Bank Wealth Management.
"In the near-term, this is going to become a technical game of price levels and where speculators are going to capitulate. If we start to get through the lows of January, that could force some speculators to retrench their position."
Hedge funds and other speculators raised their net long U.S. crude futures and options positions in the week to Jan. 31 to the highest level on record, data from the U.S. Commodity Futures Trading Commission showed last week.
"The crude oil inventory build was really terrible for the market but the market does not seem to care because the products inventories were better than expected and are dragging crude oil prices up with it," said Andrew Lipow, president of Lipow Oil Associates in Houston.
U.S. West Texas Intermediate (WTI) crude settled Wednesday's session at $52.34 a barrel, up 17 cents.
International Brent crude futures were trading at $55.13 per barrel at 2:34 p.m. ET (1934 GMT), up 8 cents, from their previous close.
Gasoline futures jumped 4.2 percent to a session high after EIA data showed a surprise decline in inventories last week after five straight weeks of increases.
The U.S. gasoline crack spread, a key measure of refiner margins, jumped as much as 20 percent, the biggest daily percentage gain since early November.
Still, analysts said the gasoline market remained oversupplied.
"Prompt (U.S. East Coast) gasoline cracks continue to sell off and the contango in U.S. gasoline futures is deepening, reflecting the likelihood that the overhang will be carried into the summer months," Energy Aspects said in a note.
Weekly U.S. oil production also ticked up, preliminary data showed, continuing a trend that has pushed the nation's four-week average output higher lately.
Analysts said prices could be volatile as higher U.S. crude supplies offset output cuts by the Organization of the Petroleum Exporting Countries (OPEC) and other producing nations.
Rising U.S. output is not worrying OPEC for the time being, Qatari Energy Minister Mohammed al-Sada told Reuters, saying "the demand is healthy."
Earlier in the session, prices came under pressure from signs of slowing demand from the world's biggest energy consumer.
China's 2016 oil demand grew at its slowest pace in at least three years, Reuters calculations based on official data showed.
China's implied oil demand growth eased to 2.5 percent in 2016, down from 3.1 percent in 2015 and 3.8 percent in 2014.
— CNBC's Tom DiChristopher contributed to this report.