Oil prices closed higher Wednesday after seesawing between gains and losses after the U.S. Energy Department reported that American stockpiles rose unexpectedly the previous week.

Supplies increased by 4.1 million barrels to 358.3 million barrels.

S&P/TSX Energy Index 3-month chartS&P/TSX Energy Index 3-month chart

Traders surveyed by Dow Jones Newswires had predicted a drop of 200,000 barrels.

Benchmark crude for October delivery closed up 89 cents to $72.52 US a barrel on the New York Mercantile Exchange.

The contract tumbled $1.47 to settle at $71.63 on Tuesday as news of a big fall in U.S. home sales for July added to worries of a faltering recovery.

In Toronto, the S&P/TSX energy index gained 0.2 per cent, following a 13 per cent decline over the past three weeks.

Prices have dropped by more than $10 a barrel since early August.

A week earlier, the U.S. Energy Department reported that U.S. supplies of oil rose to their highest level in nearly 27 years.

American Petroleum Institute figures released late Tuesday showed an unexpected draw of 1.85 million barrels in crude inventories the previous week, but gasoline supplies rose by 692,000 barrels.

Demand has been tepid for most of the summer, and refiners are cranking out products near their operating capacity, keeping inventories high.

With files from The Associated Press