The Toronto stock market closed lower Friday as investors took in encouraging manufacturing data from China and the United States

The S&P/TSX composite index declined 23.8 points to 13,337.46, pressured by continued weakness in the gold sector as prices hit a two-week low and Barrick Gold (TSX:ABX) announced a huge stock offering.

“Gold is getting crushed, but gold is a flight to safety,” said Wes Mills, chief investment officer Scotia Asset Management PM Advisor Services.

“And so, gold coming off the way it is, is a confirmation that the global economy is in fact improving.”

The Canadian dollar was unchanged at 95.9 cents US.

U.S. indexes were higher after the Institute for Supply Management reported the factory sector showed greater than expected expansion during October, rising to 56.4 from 56.2 in September. Economists had expected the index to dip to 50.9. Anything above 50 indicates expansion.

The Dow Jones industrials closed up 69.8 points to 15,615.55, the Nasdaq rose 2.34 points to 3,922.04 and the S&P 500 index was up 5.1 points to 1,761.64.

Earlier, HSBC Corp. said its monthly purchasing managers’ index for China showed its best improvement in seven months, rising to 50.9 from September’s 50.2.

And an industry group, the China Federation of Logistics and Purchasing, said its index rose to 51.4 from the previous month’s 51.1.

China’s economic growth rebounded to 7.8 per cent in the three months ending in September, from the previous quarter’s two-decade low of 7.5 per cent.

The ISM data will also be carefully weighed as to how it might affect the timing of the U.S. Federal Reserve in cutting back on a key stimulus program, its monthly purchases of US$85 billion of bonds.

The Fed announced earlier this week it would carry on with the program, which is credited with keeping long-term interest rates low and therefore encouraging more people to buy equities. But there remains much speculation about when the Fed might start to taper those asset purchases.

That speculation helped send North American markets lower Thursday but they ended up higher for the month.

The TSX rose 4.5 per cent during October, adding up to a 7.5 per cent gain for 2013 so far. And many analysts think the market has further room to improve.

“The bottom line, I step back and I say, OK, is the economic trend up and it is,” added Mills.

“And so until we get confirmation that in fact things are rolling over, then I’m OK with it because markets won’t always sit at perfect equilibrium.”

The gold sector fell about 4.55 per cent while December bullion closed $10.50 lower to US$1,313.20 an ounce. Goldcorp Inc. (TSX:G) fell $1.22 to C$25.34.

Barrick Gold (TSX:ABX) fell $1.56 or 7.69 per cent to $18.72 after it unveiled plans to raise roughly $3 billion to repay debt by issuing 163.5 million shares at $18.35 per share. Barrick also announced Thursday that it was suspending work on its troubled Pascua-Lama project as it moved to rein in costs at the mine under construction high in the Andes mountains.

Base metal stocks were also weak, down 1.3 per cent. December copper had received an earlier boost from the Chinese data but later was unchanged at US$3.30 a pound.

The sector was weighed down in particular by Taseko Mines (TSX:TKO). Its stock fell 25 cents or 9.77 per cent to $2.31 after a new environmental study into its billion-dollar New Prosperity mine proposal in British Columbia said it would pose “several significant adverse environmental effects.”

The energy sector was 1.2 per cent lower as December crude on the New York Mercantile Exchange moved down $1.77 to US$94.61. Crude has fallen 3.3 per cent this week following data out mid-week showing a sharp spike in U.S. supplies last week. Suncor Energy (TSX:SU) fell $1.09 to $36.80.

Industrial stocks were positive with Canadian National Railway (TSX:CNR) shares up $1.31 to $115.86 after earlier hitting a 52-week high of $116.98. CN announced that it has reached tentative agreements with the Teamsters Canada Rail Conference, which represents 3,000 workers.

In other corporate developments, SNC-Lavalin shares were ahead 71 cents to $44.52 as the engineering giant swung to a $72.7-million loss in the third-quarter. SNC has warned that its net income for the full year would drop dramatically due to money-losing legacy contracts, weak mining markets and a European restructuring charge.

Last week, the TSX ended down 0.46 per cent as gold stocks fell further into negative territory and bullion prices continued to lose ground.

But the market is coming off its best month of 2013, running ahead 4.5 per cent during October, leaving the TSX up 7.26 per cent year to date.