(Updates prices to close)
* TSX up 26.32 points, or 0.16 percent, to 16,159.67
* Six of the TSX's 10 main groups lower
TORONTO, Dec 20 (Reuters) - Canada's main stock index gained on Wednesday as energy and mining stocks rose and BlackBerry Ltd surged after its quarterly earnings beat expectations.
* The Toronto Stock Exchange's S&P/TSX composite index closed up 26.32 points, or 0.16 percent, at 16,159.67.
* BlackBerry jumped as much as 13.6 percent to its highest level since May 2013 after beating analysts' earnings estimates with strong enterprise software sales and licensing revenue. It ended up 11.6 percent at C$15.59.
* The energy group climbed 1.9 percent, with Encana Corp jumping 7.2 percent to C$15.46 and Canadian Natural Resources Ltd adding 0.9 percent to C$43.90, as oil prices rose.
* The materials group, which includes precious and base metals miners and fertilizer companies, added 1.2 percent. Teck Resources Ltd rose 2.8 percent to C$31.75 and First Quantum Minerals Ltd was up 3.3 percent at C$17.47 as copper prices hit a two-month high.
* The two natural resource groups combined account for 30 percent of the index's weight.
* Six of the index's 10 main groups fell, while advancers outnumbered decliners by a 1.3-to-1 ratio overall. (Reporting by Alastair Sharp; Editing by Jeffrey Benkoe and Leslie Adler)