Oil prices edged higher on Wednesday, as surging U.S. fuel demand and strong refinery runs offset data from the Energy Department that showed crude inventories did not fall as much as expected last week.
Crude inventories in the United States fell by 1.5 million barrels in the week to July 28, the Energy Information Administration said, about half the decline analysts had expected.
However, the report also showed estimated weekly gasoline demand at a record high 9.842 million barrels.
Brent crude futures ended the session up 1.1 percent, or 58 cents, at $52.36 a barrel after hitting a session low of $51.18.
U.S. West Texas Intermediate crude rose 0.9 percent to settle at $49.59 a barrel, after falling to a low of $48.55 earlier in the session.
Strong refinery runs continued to boost demand for crude. Refinery crude runs rose by 123,000 barrels per day last week, EIA data showed.
"I would expect the bulls to re-assert control over the market after the initial knee-jerk lower," David Thompson, executive vice president at Powerhouse, an energy-specialized commodities broker in Washington.
"Despite the week-to-week move lower in distillate demand, comparing the rolling four-week average of this year to last, distillate demand is running a whopping 14.5 percent over the same period last year."
HollyFrontier Corp said it plans to run its five refineries at or slightly above their combined capacity of 457,000 barrels per day (bpd) in third quarter.
Petromatrix strategist Olivier Jakob said Wednesday's price rise had more to do with technical trading than fundamentals.
"We are trading around the 200-day moving average and I think that is where a lot of the action of the last two days has been," Jakob said.
Brent futures fell below their 200-day moving average on Monday, but by Wednesday managed to vault above this trendline, last around $51.84 a barrel.
Oil prices fell sharply on Tuesday, and have come under pressure in recent sessions on news top oil producing countries may be boosting output.
OPEC oil output rose in July to a 2017 high, a Reuters survey found, led by a further recovery in supply from Libya, one of the countries exempt from a production-cutting deal. Iran's oil exports also increased.
Russia's oil output stood at 10.95 million barrels per day (bpd) in July, unchanged for a third month and in line with its pledge to curb production, government data showed on Wednesday.
Energy consultancy Douglas Westwood predicted that the oil market glut will return next year and last until 2021.
"Oversupply will actually return in 2018. This is due to the start-up of fields sanctioned prior to the downturn," said Steve Robertson, head of research for global oilfield services at Douglas Westwood.
(By Devika Krishna Kumar; Additional reporting by Amanda Cooper in London, Henning Gloystein in Singapore; Editing by Bernadette Baum, David Gregorio and Frances Kerry)