TORONTO - The Toronto stock market drifted to a lower close Friday as a late-day wave of pessimism about economic prospects trumped gains from the gold sector as bullion prices advanced to another record high.

The S&P/TSX composite index moved 18.38 points lower to 11,927.59.

The TSX Venture Exchange climbed 6.8 points to 1,488.18.

The TSX gold sector was the leading group as investors shunning risk pushed the August bullion contract in New York up $9.60 to a record high close of US$1,258.30 an ounce. Barrick Gold Corp. (TSX:ABX) gained 91 cents to C$47.01.

An easing of fears about the European debt crisis had helped lift the TSX earlier in the session.

Worries about the European fiscal crisis decreased after Spain, one of the countries most pressured by markets, successfully sold bonds. Although Spain faced higher costs to borrow money, demand for the debt was healthy, boosting sentiment among investors worried that Madrid might need a financial backstop.

Also, the EU's 27 leaders agreed Thursday to publish the results of tests that check the stability of banks.

But investors got nervous in the final minutes of trading a day after the release of tepid U.S. data that included the Conference Board's gauge of future economic activity, which signalled slow growth in the U.S. economy in the summer and fall. The data reminded investors of the fragility of the recovery.

"There's not a lot of conviction," said Adrian Mastracci, portfolio manager at KCM Wealth Management in Vancouver.

"The (economic) data has been lukewarm. It has not been stellar, (but) it hasn't been really bad. I expect a sort of sideways, rangebound movement."

The Canadian dollar rose 0.55 of a cent to 97.92 cents US as a snapshot of future economic growth in Canada registered a solid gain last month. Statistics Canada says its index of leading indicators rose 0.9 per cent in May, with manufacturing leading the way.

The agency says that's a turnaround from a year ago, when housing and the stock market were the drivers.

Telecoms led decliners with BCE Inc. (TSX:BCE) down 74 cents at $31.

The energy sector was off 0.2 per cent even as oil prices reversed direction and the July crude contract on the New York Mercantile Exchange climbed 39 cents to US$77.18 a barrel. Prices had moved lower Thursday and early on Friday after data showed rising U.S. crude inventories. Suncor Energy (TSX:SU) lost 27 cents to C$34.44.

The base metals sector was down 0.31 per cent as the July copper contract on the Nymex dipped two cents to US$2.88 a pound. Equinox Minerals (TSX:EQN) stepped back nine cents to C$3.82.

The dip followed a report from the World Bank saying that China's economy is showing signs of softening after its strong stimulus-fuelled rebound last year.

The bank said industrial production and other key indicators show the pace of growth moderating, albeit remaining relatively strong, and forecast China's growth at 9.5 per cent this year, slowing from an annualized rate of 11.9 per cent in the first quarter.

A strong Chinese economy and high demand for oil and metals helped send the resource-heavy TSX up more than 30 per cent last year.

The consumer discretionary sector was off about one per cent with shares in soft drink maker Cott Corp. (TSX:BCB) falling 71 cents to $7.39.

Shoppers Drug Mart (TSX:SC) was down 33 cents to $34.21. The Globe and Mail has reported that the chain's popular rewards program is about to get less rewarding for customers just as new generic drug rules start to squeeze the retailer's bottom line. It says changes to the chain's Optimum loyalty program mean that customers will have to spend at least $800 before they begin to receive benefits, up from $700.

New York indexes were slightly higher as the Dow Jones industrial average rose 16.47 points to 10,450.64.

The Nasdaq composite index was up 2.64 points at 2,309.8 while the S&P 500 index rose 1.47 points to 1,117.51.

The Toronto and New York markets ended the week positive with the TSX up 2.5 per cent over the five days of trading, while the Dow industrials gained 2.34 per cent.

In corporate news, the chairman of BP says embattled chief executive Tony Hayward is being relieved of day-to-day responsibility for managing the Gulf of Mexico oil spill, a day after he angered U.S. legislators with what they considered his stonewalling on many of their questions.

Earlier Friday, Moody's Investors Service said it was downgrading the senior unsecured ratings of BP. Moody's cited the worsening impact of the oil spill, saying the catastrophe will hurt BP's finances for years to come. The company's shares rose five cents to US$31.76 in New York.

Tembec Inc. (TSX:TMB) forecast that its operational earnings for the fiscal third quarter ending June 26 will be up at least 42 per cent from the prior three-month period. The Montreal-based forestry company says it expected third-quarter EBITDA, a measure of earnings that excludes a number of non-operational items, to be in the range of $47 million to $53 million.

That's up from EBITDA of $32 million in the fiscal second quarter, ended March 27 and Tembec shares rose 48 cents or 27.59 per cent to $2.22.

Gammon Gold Inc. (TSX:GAM) shares faded 28 cents to $6.76 as the company announced it is adding to its extensive mineral concessions in Mexico with a deal to acquire a 43,229-hectare block from Valdez Gold Inc. (TSXV:VAZ) for $2.5 million.