Brent crude, the global benchmark, was up 8 cents at $58.41 a barrel by 0437 GMT, after settling on Tuesday up 96 cents, or 1.7 percent. U.S. West Texas Intermediate crude was trading down 4 cents at $52.43, Reuters said.

Saudi Arabia's Energy Minister Khalid al-Falih said on Wednesday the focus remained on reducing oil stocks in industrialized countries to their five-year average and raised the prospect of prolonged output restraint once an OPEC-led supply-cutting pact ends.

Read alsoReuters: Oil prices inch up, support from drop in southern Iraq exportsThe Organization of the Petroleum Exporting Countries (OPEC), plus Russia and nine other producers, have cut oil output by about 1.8 million barrels per day (bpd) since January. The pact runs to March 2018, but they are considering extending it.

"OPEC is holding a line on the production cuts," said Tony Nunan, oil risk manager at Mitsubishi Corp in Tokyo. "Even though shale (output) is now rebounding, the stocks are drawing, and now we're heading into the winter season, so the market is strong."

U.S. crude stocks rose by 519,000 barrels last week, industry group the American Petroleum Institute said on Tuesday. That compared with analysts' expectations for a decline of 2.6 million barrels.

Gasoline inventories fell by 5.8 million barrels, compared with analysts' expectations for a 17,000 barrel decline. Distillate fuel stockpiles, which include diesel and heating oil, fell by 4.9 million barrels, compared with expectations for an 860,000 barrel drop, the API data showed.

Following the large drop in gasoline stockpiles, U.S. gasoline futures rose as high as $1.7383 per gallon, the most since Sept. 26. The profit margin for gasoline over WTI climbed to as much as $18.60 a barrel, the highest in a month.

The U.S. Energy Information Administration will release official government inventory data later on Wednesday.

The disruptions to exports from Iraq, OPEC's second-largest producer, as Iraqi pro-government paramilitaries fight against Kurdish separatists have also provided support to oil prices.

Crude oil flows through the Iraqi Kurdistan pipeline to Turkey's port of Ceyhan were up slightly at 300,000 bpd on Tuesday, about half the level before the Iraqi takeover of Kirkuk.

"The situation is Iraq is pushing prices up a little bit, but it's going to be different than before because the higher the prices go, the more the shale can rebound," Nunan said.