Crude-oil futures finished higher Wednesday on data showing a steep drop in U.S. oil inventories last week.

Prices were also boosted by comments from Federal Reserve Chairman Ben Bernanke suggesting the U.S. central bank was open to restarting its controversial stimulus program.

Light, sweet crude oil for August delivery settled up 62 cents, or 0.6%, to $98.05 a barrel on the New York Mercantile Exchange. Brent crude oil on the ICE Futures Europe exchange settled up $1.03, or 0.9%, to $118.78 a barrel.

The federal Energy Information Administration said crude-oil stockpiles last week fell by a greater-than-expected 3.1 million barrels. Futures rose on the report, which was taken as a sign of improving oil demand in the world's largest crude-oil consumer.

Noteworthy was the EIA's divergence from similar data compiled by the American Petroleum Institute, an industry group. On Tuesday, the API reported that U.S. oil stockpiles rose last week, and many traders were expecting a similar result in Wednesday's data.

"That's why the market popped as it did," said Peter Donovan, vice president at oil options brokerage Vantage Trading in New York.

The EIA said gasoline inventories fell 800,000 barrels last week. Stockpiles of distillates, including heating oil and diesel, rose three million barrels.

Analysts expected oil stocks to fall 1.3 million barrels last week. They expected gasoline stocks to increase 100,000 barrels and distillate stocks to rise 200,000 barrels.

Although oil traders focused on the drop in oil supplies, other indicators of U.S. oil and fuel demand offered a mixed picture. The EIA said gasoline demand during the July 4 holiday week was the lowest since 2003, while distillate demand was at a 20-month low last week.

Uncertainty about the strength of U.S. demand has been a major factor keeping oil prices below their recent highs. Although many analysts expect rising demand from emerging markets including China to pull Nymex crude oil back above $100 a barrel this year, the contract remains well below its high of around $115 a barrel reached in May.

Crude-oil prices were trading in negative territory prior to the EIA's morning report, though they began trading higher after Bernanke, in testimony to Congress, suggested the central bank was open to a third round of quantitative easing.

The bond-buying program in the past was aimed at infusing liquidity into U.S. markets. Oil traders are keenly eyeing the prospect of additional easing, which has been tied to a weakening dollar and higher oil prices.

"If you're going to out there and do another QE, you have to expect the market's going to go back to the risk-on formula--they're going to buy equities, they're going to buy gold, they're going to buy oil," said Bill O'Grady, chief market strategist at Confluence Investment Management in St. Louis.

The ICE Dollar Index, which tracks the dollar against a basket of currencies, was recently down 1% at 75.210. A weaker dollar often boosts oil prices by making the dollar-denominated commodity cheaper for holders of other currencies.

Front-month August reformulated gasoline blendstock, or RBOB, settled up 5.34 cents, or 1.7%, to $3.1516 a gallon. August heating oil settled up 1.21 cents, or 0.4%, to $3.0997 a gallon.