Oil edged higher on Wednesday, shaking off earlier losses following a large build up in U.S. gasoline inventories, buoyed by gains in the stock market and heavy spread trading.
Data from the U.S. Energy Information Administration showing a 3.65 million barrel rise in gasoline inventories last week, in the midst of the summer driving season, weighed down prices in early U.S. activity.
But markets got a boost after weak gross domestic product data prompted speculation the U.S. Federal Reserve would maintain its monetary stimulus, helping to push up stocks and crude. U.S. GDP expanded at a 1.8 percent annual rate in the quarter, adjusted from a previous estimate of 2.4 percent.
In addition, traders said heavy trading of the Brent-West Texas Intermediate spread, which settled at $5.94 on Tuesday and widened out to $6.23 on Wednesday, supported prices late in the day. The spread has dropped sharply from over $23 a barrel in February as new pipeline capacity eased a glut of crude in the U.S. Midwest.
"I think there is some end of the quarter profit-taking in that spread and I think at the end of the day we rallied back," said Addison Armstrong, director of market research, Tradition Energy in Stamford, Connecticut.
Brent crude for August delivery gained 40 cents to settle at $101.66 a barrel. U.S. crude rose 18 cents to settle at $95.50 a barrel.
The Brent benchmark is down 8.5 percent for the quarter, its third quarterly loss in a row, having dropped after Fed Chairman Ben Bernanke laid out a roadmap last week to slow bond buying and on concerns about an economic slowdown in China.
Also supporting prices, European Central Bank President Mario Draghi said on Wednesday the ECB was nowhere near exiting its accommodative monetary policy, while seeing gradual recovery in the region by the end of the year.
Deutsche Bank lowered its projections for oil prices in the second half of 2013, with Brent set to average $106 a barrel and the U.S. benchmark forecast to average $96 a barrel.
"Prospects for loose fundamentals to persist combined with a bullish U.S. dollar outlook have prompted us to lower our price decks," the bank said in a report.