The Toronto stock market closed slightly ahead Thursday after wobbling between positive and negative territory for most of the day as higher gold stocks competed with weakness in the financial and energy sectors.

The S&P/TSX composite index was up 28.51 points at 12,173.35, while the TSX Venture Exchange gained 20.10 points to 1,650.34.

"You have a market where there's a massive tug of war taking place between bulls and bears, with valid arguments being made on both sides," said Andrew Pyle, investment adviser with ScotiaMcLeod in Peterborough, Ont. "But what that does is result in a market that has little conviction."

The gold sector moved higher as the precious metal continued a rally that has seen it hit record high after record high.

The December bullion contract on the New York Mercantile Exchange added $5.10 to close at US$1,273.80 an ounce -- its second all-time high this week. Shares in Barrick Gold Corp. (TSX:ABX) gained 93 cents or two per cent to C$47.12.

The Toronto energy sector fell 0.3 per cent. The October crude contract tumbled $1.45 to US$74.57 a barrel amid stubbornly high U.S. crude inventory surpluses and new economic data that signalled slower demand for oil and gas.

Shares in Suncor Energy Inc. (TSX:SU) were down 66 cents at C$33.04.

And the financial sector lost 0.5 per cent. Shares in Bank of Nova Scotia (TSX:BNS) were down 49 cents at $53.26 after the bank said it will acquire Brazil's Dresdner Bank Brasil S.A., a week after announcing the creation of a separate wealth management unit to capitalize on international opportunities. Terms of the deal were not disclosed.

The optimistic tone investors have struck for much of September took a hit after a report showed manufacturing activity in the U.S. mid-Atlantic region contracted for the second straight month in September. This followed a similar report Wednesday for New York state that showed manufacturing activity fell this month to its lowest level since July 2009.

Paul Ashworth, senior U.S. economist with Capital Economics Ltd., said the Philly Fed survey is treading in "recessionary territory."

"All we can hope is that this survey is giving an overly pessimistic view," he commented.

Toronto's metals and mining sector added one per cent as the December copper contract gained 2.7 cents to US$3.49 a pound. But shares in HudBay Minerals Inc. (TSX:HBM) fell nine cents to C$15.14.

The Canadian dollar slipped 0.02 of a cent to 97.41 cents US.

On Wall Street, the Dow Jones industrial average gained 22.10 points to 10,594.83. The Nasdaq composite index was up 1.93 points at 2,303.25, while the S&P 500 lost 0.41 of a point to 1,124.66.

Investors failed to find solace in data from the U.S. Labour Department that showed the number of newly laid-off workers seeking unemployment benefits dropped slightly last week to its lowest level in two months, a sign that employers are cutting fewer jobs.

Initial claims are still above levels that would signal widespread hiring, however.

"While the dip in initial claims is encouraging, we expect that the pace of improvement in economic activity going forward will not be sufficient to move the unemployment rate markedly lower in the near-term," remarked Nathan Janzen, an economist with RBC Economics.

In corporate news, FedEx Corp. (NYSE:FDX) said its fiscal first-quarter earnings doubled, but the company plans to cut 1,700 jobs as it consolidates trucking operations to save money. The company also raised its quarterly earnings outlook, but the forecast was still shy of analysts' expectations. FedEx shares fell $3.22 or 3.8 per cent to US$82.72 on the New York Stock Exchange.

Canadian energy company Enbridge Inc. (TSX:ENB) said it has finished repairs on a pipeline in Illinois that sprang a leak earlier this month and is working to return the line to service. The spill near Chicago followed a spill in Michigan, which was the subject of hearings by a congressional panel in Washington on Wednesday. Enbridge shares fell 35 cents to C$51.89.

Power producer Boralex Inc. (TSX:BLX) said that a majority of the units of Boralex Power Income Fund (TSX:BPT.UN) have been tendered to its takeover offer. Boralex shares gained 48 cents or 6.4 per cent to $8, while units in Boralex Power added seven cents to $5.05.

A business magazine reported that state-owned Chinese company Sinochem Corp. is seeking government approval to make a competing bid to BHP Billiton's US$38.5-billion offer for Canada's Potash Corp. of Saskatchewan Inc. (TSX:POT). PotashCorp shares added $1.36 to C$151.88.

Two proxy advisory services firms have sided with Casey's General Stores (Nasdaq:CASY), saying a slate of board nominees being pushed by hostile bidder Alimentation Couche-Tard (TSX:ATD.B) are not in the best interests of Casey's shareholders. Couche-Tard shares added 65 cents or 2.9 per cent to $22.91.

And shares in CIC Energy Corp. (TSX:ELC) soared $2.65 or 81.5 per cent to C$5.90 after the company said it has received a takeover bid from an unidentified Indian conglomerate that values the company at about US$450 million -- almost triple its pre-bid market value.