News of stepped-up US sanctions on Iran Wednesday overcame an early decline in oil prices, leaving the commodity nearly flat.
The cost of a barrel of West Texas Intermediate oil for March delivery ended two cents lower at $96.62 on the New York Mercantile Exchange.
In London, the price of a barrel of European benchmark Brent closed at $116.73, up 21 cents from Tuesday.
US oil prices were down about $1.60 a barrel early in the session, but largely recovered those losses after the US Treasury Department announced new sanctions targeting Iranian oil revenue.
Under the plan unveiled Wednesday, Iran is denied direct access to the money from its oil sales to other countries.
"The main mover this morning was the new US sanctions that hampered the Iranian oil trade," said Rich Ilczyszyn of iiTrader.com. "The market sold off pretty good this morning and, on that story, came all the way back."
The action followed a weekly US oil inventory report that was fairly market-neutral.
The US government's Energy Information Administration announced Wednesday that American oil stockpiles climbed by 2.6 million barrels in the week ending February 1.
While a build of oil is a bearish development, the amount undershot expectations of a larger gain of 2.9 million barrels, according to analysts polled by Dow Jones Newswires, suggesting stronger-than-expected energy demand in the world's biggest economy.
The report also showed that crude oil stocks at the much-watched Cushing, Oklahoma hub fell 300,000 compared with last week. The oil market has for months been fixated on the build-up of excess supplies at Cushing.
Crude futures had fallen in earlier trading as traders took profits and the market was pressured by the stronger greenback, which makes dollar-priced crude more expensive for buyers using weaker currencies.