TORONTO - The Toronto stock market gained traction in the final minutes of trading Friday, closing higher on the strength of the gold sector and a soaring oil price.

The S&P/TSX composite index added 63.56 points to 12,097.09, while the TSX Venture Exchange gained 14.5 points to 1,596.5.

The gold sector was the biggest gainer, rebounding after big declines over the last couple of days. The declines followed a drop in the gold price after it hit a record high on Tuesday.

The December bullion contract lost $4.40 to US$1,246.50 an ounce as investors continued to venture out of the safe-haven investment.

Shares in Barrick Gold Corp. (TSX:ABX) gained 67 cents to C$46.36.

The energy sector gained 0.6 per cent as the October crude contract on the New York Mercantile Exchange surged $2.20 to US$76.45 a barrel. Better economic indicators from Japan to the U.S. boosted confidence that demand for fuel will improve, and a pipeline shutdown after a leak raised demand concerns in the United States.

Shares in Suncor Energy Inc. (TSX:SU) added 34 cents to C$34.10.

A report from Statistics Canada that the jobless rate increased one-tenth of a point to 8.1 per cent last month seemed to have little impact on the market. Economists had expected the number of unemployed to hold steady at eight per cent.

The news added new evidence that the slowing economy is taking a toll on the country's previously buoyant labour market. Although the economy actually created 35,800 net new jobs last month, that gain turns into a loss once the seasonal variation that came from educational employees going back to work is discounted.

The Canadian dollar rose in early trading on the news that the economy added jobs, but reversed course by the end of the day, losing of 0.13 of a cent to 96.61 cents US.

"I believe there were so many moving parts in this report that the market didn't quite know what to make of it," said Doug Porter, deputy chief economist at BMO Capital Markets.

"Overall for the markets, there's not a lot of news here because it is so mixed and distorted."

The Toronto telecom sector edged up 0.3 per cent after BCE Inc. (TSX:BCE) announced it is buying up the rest of the CTV television network that it doesn't already own for C$1.3 billion. Shares in BCE gained 14 cents to $32.99, while shares in Torstar Corp. (TSX:TS.B), which is selling its 20 per cent stake in CTVglobemedia, soared $2.08 or 21 per cent to $12.

The metals and mining sector added 0.5 per cent even as the December copper contract fell 3.7 cents at US$3.41 a pound. Shares in HudBay Minerals Inc. (TSX:HBM) added two cents to C$14.96.

The financial sector was up 0.6 per cent. Shares in CIBC (TSX:CM) gained 15 cents to $74.60.

Wall Street moved higher after a report said inventories held by U.S. wholesalers rose in July by 1.3 per cent -- the largest amount in two years -- while sales rebounded 0.6 per cent after two straight declines.

Businesses restocking their depleted store shelves have been a major driver of the economy since late last year, and the strong gain seen in July should help alleviate fears that the country could be in danger of slipping into another recession.

The Dow Jones industrial average added 47.53 points to 10,462.77. The Nasdaq composite index was up 6.28 points to 2,242.48, while the S&P 500 gained 5.37 points to 1,109.55.

U.S. stocks have rallied since the beginning of the month as economic indicators have shown mild improvements, although investors are still highly sensitive to bad news.

In economic news, revised figures show that Japan's gross domestic product expanded at an annualized rate of 1.5 per cent in the April to June period, an improvement on the meagre 0.4 per cent reported in last month's preliminary report.

And China's trade surplus with the world hit US$20 billion, its second-highest level this year in August, as export growth weakened while import growth rebounded.

In corporate news, yoga retailer Lululemon Athletica Inc. (TSX:LLL) more than doubled its profits in the second quarter to C$21.8 million as the company generated a 56 per cent jump in revenues to $152.2 million. Shares in the company soared $4.83 or 13 per cent to $41.89.

Sobey's grocery store chain owner Empire Company Ltd. (TSX:EMP.A) said its first-quarter profits slipped nine per cent to $81.6 million on lower capital gains. Revenue increased by 1.8 per cent to $4.04 billion. Shares in Empire fell $1.58 or 2.9 per cent to $52.27.

And shares in energy company Enbridge Inc. (TSX:ENB) lost 38 cents to $52.50 after an Illinois pipeline was shut down due to a leak. The shutdown comes on the heels of another leak in a Michigan pipeline this summer that caused a major spill.