Firmer oil prices helped the benchmark index of the Toronto Stock Exchange close with a modest gain on Wednesday.

The S&P/TSX composite index closed up 12.99 points, or 0.12%, at 10,686.83.

It was a volatile day, as the index tanked around 150 points within minutes of the opening bell, then sprang up as high as 70 points during mid-afternoon.

Crude futures soared nearly 5% on Wednesday to finish at their highest level since early June, after a U.S. government report showed the biggest drop in crude inventories since May.

Light sweet crude for September delivery surged US$3.23, or 4.7%, to end at US$72.42 a barrel on the New York Mercantile Exchange.

In Toronto, shares of EnCana Corp. rose 0.6%.

Gold for December delivery ended up US$5.60, or 0.6%, at US$944.80 an ounce on the Comex division of the New York Mercantile Exchange.

Barrick Gold Corp. shares rose 0.5%.

Among financial stocks, Toronto-Dominion Bank was up 1.7% and Bank of Montreal gained 1%.

The junior S&P/TSX Venture composite index gained 10.45 points, or 0.90%, to finish at 1,176.95.

The Canadian dollar rose 0.51 of a cent to close at US91.27¢.

In New York, U.S. stocks rose as rising crude oil prices helped shake off a slide in China’s equity market.

The Dow Jones industrial average gained 61.22 points, or 0.66%, to 9,279.16. The S&P 500 rose 6.79 points, or 0.69%, to 996.46. The Nasdaq composite index added 13.32 points, or 0.68%, to 1,969.24.

IE