(Adds analyst quote, adds details, updates prices)
* TSX up 34.1 points, or 0.26 percent, to 13,358.77
* Seven of the TSX's 10 main groups rise
By Fergal Smith
TORONTO, Dec 4 (Reuters) - Canada's main stock index closed higher on Friday, helped by a rally in gold stocks and firming in financials, while weakness in crude oil prices weighed on the energy sector.
The rally in gold miners was "the big feature," according to John Ing, president of Maison Placements Canada, adding that they "were very oversold."
Gold futures rallied more than $22, while U.S. crude oil prices settled below $40 a barrel after the Organization of the Petroleum Exporting Countries failed to agree on a new production quota.
Barrick Gold Corp advanced 7.1 percent to C$10.81, while Goldcorp Inc was up 5.8 percent at C$17.03.
The overall materials sector, which includes miners, fertilizer companies and lumber producers, rose more than 3 percent.
Financials rose 0.5 percent, including a 0.9 percent gain for Toronto-Dominion Bank to C$54.77.
The Toronto Stock Exchange's S&P/TSX composite index closed up 34.1 points, or 0.26 percent, at 13,358.77, but little changed for the week.
Seven of the index's 10 main groups were in positive territory.
Energy stocks fell 2.2 percent, including a 2.0 percent drop in Suncor Energy Inc to C$36.03.
U.S. crude prices settled at $39.97 a barrel, down 2.7 percent, while Brent crude lost 1.5 percent to $43.19.
Canadian Pacific Railway fell 4.1 percent to C$180.15 after Norfolk Southern Corp rejected its $28.4 billion acquisition proposal.
U.S. jobs data suggested that the economy is strong enough to sustain a Federal Reserve rate hike this month, overshadowing disappointing Canadian jobs and trade data. (Reporting by Alastair Sharp; Editing by Frances Kerry and Lisa Shumaker)