U.S. crude futures rose for a third consecutive day on Wednesday, closing at new 2016 highs on supply outages led by the sabotage of oil facilities in Nigeria.
U.S. crude stocks fell for the third consecutive week to June 3, sliding by 3.2 million barrels versus analysts' expectations for a 2.7 million-barrel drawdown, government data showed.
But gasoline stockpiles grew by 1 million barrels and distillates, which include diesel and heating oil, rose 1.8 million barrels, versus forecasts of drawdowns.
This indicates a sentiment that gasoline demand will weaken more than expected or that the crude glut will be reflected by a gasoline glut, said Troy Vincent, crude oil analyst for New York-headquartered energy data provider ClipperData.
U.S. crude production ticked up by 10,000 barrels per day to 8,745,000 bpd from the previous week, reversing a 15-week trend of declining output.
Futures briefly gave up some gains after the data release, but had mostly rebounded by midday.
U.S. crude futures settled 87 cents higher, or 1.7 percent at $51.23 a barrel, having hit $51.34, the highest level since July, earlier in the session.
Global benchmark Brent crude futures rose by $1.07, or 2.1 percent, at $52.50 a barrel, after striking a high going back to Oct. 12.
"The gasoline build was a big surprise, specially since the driving season is underway," said Tariq Zahir, managing partner at Tyche Capital Advisors in New York.
Oil hit the year's highs after the Niger Delta Avengers militant group said it had blown up a Chevron oil well in Nigeria, rejecting peace talks with the government. The Avengers have brought oil output in Nigeria, once Africa's largest crude producer, to a 20-year low.
Prices were also supported by data showing China's crude oil imports in May hit their highest in more than six years.
The dollar's drop to five-week lows on waning expectations for an imminent U.S. rate hike had added to interest in greenback-denominated oil from holders of the euro and other currencies.
Despite the retreat in crude prices, some analysts said the overall upward momentum in oil was hard to ignore. Crude futures have nearly doubled in value from the 13-year low of $27 for Brent and $26 for WTI this winter.
"The trend is your friend and picking tops can be painful as all of the money out there chasing trends from the systematic side of the market can overwhelm," said Scott Shelton, broker at ICAP in Durham, North Carolina.
Correction: This story has been updated to show that U.S. crude production rose by 10,000 barrels per day.