Oil futures settled lower Wednesday after an abrupt late-day sell-off, as traders took profits off the table following gains earlier in the session.

Futures spent most of the day in positive territory after the government said U.S. oil stockpiles fell last week as refiners ratcheted up operations.

But prices suddenly turned lower during the last 15 minutes of open outcry trading, and the selling intensified toward the close. Many market watchers expressed surprise at the sudden pullback.

"There's a lot of people scratching their head," said Carl Larry, director of energy derivatives and research at Blue Ocean Brokerage in New York.

Light, sweet crude for October delivery settled down 28 cents, or 0.3%, at $85.16 a barrel on the New York Mercantile Exchange, after hitting an intraday high of $86.59 a barrel. Brent crude on ICE Futures Europe recently traded up 82 cents, or 0.8%, to $110.13 a barrel.

Larry said some automatic sell orders may have been behind the pull-back, likely exacerbated by thin trading volumes, which can exaggerate the impact of individual trades.

"The bulls were holding it in all day and bailed in the last 20 minutes," said Stephen Schork, editor of The Schork Report energy newsletter.

Futures had spent the day higher after the Department of Energy posted a surprise 2.2-million-barrel decline in commercial oil inventories last week. The decline came on the back of higher demand from refiners, which ramped up operations by 1.2 percentage points to 90.3% of capacity.

The rally was tempered by a build in fuel stockpiles, which suggests demand among end-users in the U.S., the world's biggest crude consumer, still appears weak. Gasoline stockpiles last week rose 1.4 million barrels, while stocks of distillates, including heating oil and diesel, rose 1.7 million barrels.

"It's a bit of a mixed report," said Jason Schenker, president of Prestige Economics in Austin, Texas.

Analysts surveyed by Dow Jones Newswires had expected oil inventories to rise 1.3 million barrels. Gasoline inventories were seen falling 900,000 barrels, while distillate stocks were expected to rise 700,000 barrels. Refinery runs were expected to fall 0.1 percentage point.

Oil futures have traded in a narrow range over the last week, as market participants await additional clarity on the situation in Libya. Although the rebels have seized Col. Moammar Gadhafi's compound in Tripoli, a broad sell-off in oil prices hasn't materialized, and many traders are awaiting more concrete signs that the country's oil exports have resumed.

"I think all this optimistic talk about Libyan crude rushing back to the market probably is not right," said Bill O'Grady, chief market strategist at Confluence Investment Management in St. Louis.

The country exported 1.3 million barrels of oil a day before the outbreak of civil war in February.

Front-month September reformulated gasoline blendstock, or RBOB, settled up 0.18 cent, or 0.1%, at $2.8784 a gallon. September heating oil settled up 1.82 cents, or 0.6%, at $2.9607 a gallon.