WTI pares losses, settles down 5 cents at $59.92 a barrel

Oil prices on the rise

U.S. crude pared losses to settle down 5 cents at $59.92 on Wednesday as the dollar weakened following the U.S. Federal Reserve's decision to leave its benchmark interest rate unchanged.

Crude oil and refined products futures turned lower earlier on Wednesday in volatile trading after government data showed a surprise gasoline inventory build last week, even as production eased.

Concerns about Greece's debt problems and the potential effect on Europe's demand for petroleum also helped pressure crude futures.

Read MoreDrill, drill, drill! And then maybe go bankrupt

U.S. gasoline inventories rose unexpectedly and crude oil stocks at the Cushing, Oklahoma, hub rose for the first time since April, while refinery utilization fell, the Energy Information Administration said on Wednesday.

"The decline in refinery utilization is also bearish for crude oil price, since any diminution in demand will cause the recent trend of crude oil inventory declines to reverse," said John Kilduff, partner at Again Capital LLC in New York.

Crude chart still bearish: Technician

Crude inventories fell by 2.7 million barrels, the EIA said. While the EIA's slip was more than the expected draw of 1.7 million barrels, the drop was less than the 2.9-million-barrel slide reported on Tuesday by industry group American Petroleum Institute.

Brent futures fell 3 cents to $63.67 a barrel by 3:35 p.m. EDT (1837 GMT), having earlier fallen to $62.60.

U.S. July RBOB gasoline pared losses following the Fed statement, but was still trading negative at $2.0952 a gallon, after soaring to $2.1858, the strongest front-month price since November.

Read MoreThese stocks are signaling a top in oil, says trader

The EIA showed gasoline stocks rose by 460,000 barrels, compared with expectations in a Reuters poll for a 314,000-barrel drop and in sharp contrast to the fall of 2.9 million barrels reported by the API.

"The gasoline inventory number disappointed and then the market also refocused on Greece and Europe's situation and the potential for demand to be hit," said Phil Flynn, analyst at Price Futures Group in Chicago.

The Greek central bank warned on Wednesday that the country risked a painful exit from the euro and the European Union if Athens and its creditors do not strike a swift aid-for-reforms deal.

U.S. ultra-low sulfur diesel futures also turned higher after the Fed statement, having earlier fallen on the EIA report.