TORONTO - The Toronto stock market ended Friday in negative territory as weakness in base metals and materials edged out gold and better-than-expected earnings from BlackBerry-maker Research In Motion Ltd. (TSX:RIM).

The S&P/TSX composite index closed 9.66 points lower to 11,463.40 in a volatile trading session that slipped into the red during the final hour on high volume trading.

The Canadian dollar was ahead 0.38 of a cent to 93.81 cents US.

Pulling the index lower was weakness in the base metals sector which fell 1.4 per cent with HudBay Minerals (TSX:HBM) down nearly nine per cent to $12.83.

The materials sector also dropped 0.8 per cent with shares in Potash Corp of Saskatchewan (TSX:POT) six per cent lower to $112.00 on concerns about potash prices. Soleil Securities downgraded the company's stock to "sell" from "hold" on weakening prices, particularly in China.

On the upside, gold stocks were up 0.9 per cent as the February bullion contract closed $4.10 higher at US$1,111.50 an ounce on the New York Mercantile Exchange. Bullion prices have endured volatile session this week as the U.S. dollar fluctuated against other currencies.

"Gold is a focus of hedge fund investors and they're trading it very actively, minute-by-minute, so it's going to be extremely volatile," said Douglas Davis, president Davis Rea Ltd.

"It will be volatile for quite a few years to come, I think."

The TSX energy sector slipped 0.9 per cent as reports surfaced from the Iraqi government that an oil well had been taken over by a group of armed Iranians. The February crude contract gained 34 cents to close at $74.42, while the less active January contract ended 71 cents higher to $73.36.

RIM, a heavyweight on the Toronto Stock Exchange's main index, was ahead 10 per cent after managing to beat expectations in an earnings report issued after the closing bell Thursday. The company posted a US$628.4-million profit in the third quarter versus $396.3 million a year earlier. Its shares were ahead $6.91 to $73.96.

The TSX Venture Exchange was up 9.05 to 1,430.20.

On Wall Street, The Dow Jones industrials rose 20.63 points to 10,328.89. The Nasdaq composite index was up 31.64 points to 2,211.69, while the S&P 500 index increased 6.31 points to 1,102.39.

South of the border, other tech companies were also nabbing attention.

Software company Oracle Corp. reported strong earnings that beat analysts' expectations after the markets closed Thursday, while Palm Inc. posted a wider second-quarter loss than analysts predicted as sales of its smartphones declined.

Statistics Canada reported that wholesale sales in current dollars edged up 0.3 per cent to $41.1 billion in October, the fourth increase in five months.

In Canadian earnings, drugmaker Patheon (TSX:PTI) said its fourth-quarter earnings were $4.6 million, down from a year-ago profit of $37.3 million, as the company faced tough market conditions. Its shares rose five cents to $2.47.

Units in Sterling Shoes Income Fund (TSX:SSI.UN) plunged 26 per cent after the company suspended its monthly distributions Thursday in an effort to maintain its financial flexibility. Sterling units were down 49 cents at $1.41.

Bombardier Transportation (TSX:BBD.B) signed a US$138-million contract with a Chinese rail company to provide metro cars and training. Its shares were up five cents to $4.78.

Royal Gold Inc. (TSX:RGL) has reached an agreement to acquire International Royalty Corp. (TSX:IRC) in a deal valuing the company at about $749 million. Shares of Royal Gold were up $1.02 cents to $51.25, while Royalty gained 32 cents to $7.64.