Brent crude touched a three-month high on Wednesday after better-than-expected economic data out of Europe spurred optimism about the global economy before oil pared gains with surprisingly weak U.S. growth numbers.
Sentiment drew further support from declines in U.S. refined product stocks, although crude oil inventories rose sharply.
Brent crude futures settled 54 cents higher at $114.90 a barrel after hitting $115.24, their highest since Oct. 16. U.S. crude oil settled up 37 cents at $97.94.
U.S. RBOB gasoline futures broke the $3.00 a gallon mark for the first time since the end of September, settling up over 2 percent at $3.0387.
The U.S. economy unexpectedly contracted in the fourth quarter, suffering its first decline since the 2007-09 recession as businesses scaled back on restocking and government spending plunged.
U.S. crude oil inventories jumped by 5.95 million barrels in the week to Jan. 25, the U.S. government said. Analysts had forecast a 2.6-million-barrel crude build.
But the recent run of economic optimism overshadowed the inventory numbers and weak U.S. data.
"Overall, global macroeconomic trends such as the dollar and global equity indices hitting new 52-week highs have been pushing crude higher," said Chris Jarvis, president of Caprock Risk Management in Boston.
Euro zone economic sentiment improved more than expected across all sectors in January, rising for the third month in a row in a sign that the region's economy could be emerging from a low point in the fourth quarter of 2012.
Oil markets took the U.S. Federal Reserve's Wednesday afternoon announcement it would maintain its monthly $85 billion bond-buying stimulus plan in stride.
"For commodities, the Fed statement is definitely supportive because they expect to continue asset purchases and their accommodative policy for awhile," said Phil Flynn, analyst at Price Futures Group in Chicago.
The short-term oil outlook was also buoyed by optimism that growth is accelerating in China.
Factory activity in China is expected to have expanded at its fastest pace in nine months in January, adding to signs that recovery momentum is building as domestic demand strengthens.
Supply risks from the Middle East also supported oil prices. Israeli forces attacked a convoy suspected to include a truck carrying weapons on the Syria-Lebanon border on Wednesday, sources told Reuters.
(Additional reporting by Robert Gibbons and Eileen Houlihan in New York, Simon Falush in London, Jessica Jaganathan and Manash Goswami in Singapore; Editing by Dale Hudson, Christopher Johnson and Marguerita Choy)