Oil prices surged more than 5 percent to settle above $70 a barrel on Wednesday, buoyed by a drop in U.S. gasoline inventories last week that hinted at rising demand in the world's largest energy consumer.
Further price support came from a weak dollar, which makes crude more affordable for buyers using other currencies.
U.S. crude futures settled up $3.90 at $70.61 a barrel. London Brent crude gained $3.13 to settle at $69.07 a barrel.
Over the quarter, crude futures were little changed, up 72 cents from the June 30 close of $69.89 a barrel.
Weekly oil data from the U.S. Energy Information Administration (EIA) showed gasoline inventories dropped 1.6 million barrels instead of rising as analysts had forecast. A day earlier, industry group American Petroleum Institute also reported a decline.
Gasoline demand over the past four weeks was up by more than 5 percent, according to the report.
The real surprise was the draw on gasoline stocks. It's certainly a positive sign for gasoline prices and implied gasoline demand is also up, said Addison Armstrong, director of market research with Tradition Energy in Connecticut.
The recession and weak demand have battered oil prices, which fell from over $147 a barrel in July 2008, and traders have been looking for signs of a turnaround.
The EIA report showed inventories of crude oil and middle distillates rose last week, however, while overall demand remained weak.
Crude oil inventories increased by 2.8 million barrels last week, surpassing the average analyst forecast for a 600,000 barrel rise. The increase in middle distillate inventories was smaller than expected, but demand over the past four weeks was more than 9 percent lower than a year earlier.
The report is actually mixed, said Olivier Jakob of Swiss-based Petromatrix. Overall inventories increased and keep building up.
U.S. equities slipped slightly as a surprise drop in business activity in the U.S. Midwest, including Chicago, was partially offset by gains in commodities and tech stocks. Oil markets have looked to equities and wider economic data for signs of a rebound in the economy that could bolster fuel demand.
Political tensions related to Iran, OPEC's No. 2 producer, added support, analysts said, ahead of a meeting between diplomats from the five permanent U.N. Security Council members as well as Germany and Iran's nuclear negotiator.
(Additional reporting by Ikuko Kurahone, Christopher Johnson; Editing by David Gregorio)