TORONTO -- The Toronto stock market ended higher as the gold and materials sectors gained traction and shares of BlackBerry got a pop after the company launched a strategic review of its options.

The S&P/TSX composite index rose 52.14 points to 12,594.27. The Canadian dollar was off 0.08 of a cent to 97.06.

Shares of BlackBerry (TSX:BB) closed up nearly 11 per cent as the struggling Waterloo, Ont.-based smartphone maker said it has brought in a committee to assess the company's strategic alternatives, which could include selling the company or entering into a joint venture. BlackBerry shares gained $1.08 to $11.13.

In commodities, December bullion jumped $22 to US$1,334.20 an ounce, the September crude contract saw an uptick of 14 cents to US$106.11 a barrel and copper was ahead three cents to $3.30.

South of the border, U.S. indexes were mixed as the Dow Jones industrials fell 5.83 points to 15,419.68, the Nasdaq gained 9.84 points to 3,669.95 and the S&P 500 index was 1.95 points lower at 1,689.47.

On Tuesday, the U.S. Treasury Department reported a $97.6 billion deficit for July but said it still remains on track to post its lowest annual budget gap in five years.