* TSX falls 102.15 points, or 0.78 pct, to 12,945.63
* Materials, financials, energy sectors all lower
* Weak Canadian and U.S. economic data weighs
* Drop in oil prices also helps to pull index lower (Adds details)
TORONTO, July 29 (Reuters) - Toronto's main stock index closed sharply lower on Friday, though off the one-month low it hit earlier in the day, as weak economic data and the U.S. debt crisis pushed investors to the safety of the sidelines.
The materials sector posted the biggest drop, down 1.28 percent, followed by the financials group, which fell 0.93 percent.
Royal Bank of Canada (RY.TO) was the top heavyweight decliner, down 1.3 percent at C$51.40. Next came fertilizer producer Potash Corp (POT.TO), down 1.9 percent at C$55.16, and miner Goldcorp (G.TO), which dropped 2.2 percent to C$45.69.
The gold mining sub-group fell 1.3 percent, even as gold prices rose to new highs on weak economic data and fears of a U.S. default.
"Gold stocks are stocks, and right now everybody is being fairly cautious," said John R. Ing, President of Maison Placements. "There's fear of a pullback, so people are saying 'let's wait for the pullback'."
The Toronto Stock Exchange's S&P/TSX composite index .GSPTSE ended the session down 102.15 points, or 0.78 percent, at 12,945.63, after falling to its lowest level since June 27 earlier in the session. Eight of the 10 main index sectors finished lower.
The index was down 4.1 percent for the week, and 2.7 percent for July.
With most Canadian markets closed on Monday for various provincial holidays, anxious investors moved to the sidelines in advance of Tuesday's deadline for the United States to raise its debt ceiling.
U.S. President Barack Obama told deeply divided Republicans and Democrats on Friday to stop bickering and find a way "out of this mess". [ID:nN1E76S004]
"The Aug. 2 debt ceiling deadline is weighing," said John Kinsey, portfolio manager at Caldwell Securities. "You don't want to be short in case something good -- or bad -- happens over the weekend."
After market closed, Moody's ratings agency signalled that a downgrade of U.S. credit would not come immediately, but possibly in the medium term. [ID:nN1E76S1QO]
Moody's also placed Spain's Aa2 credit rating on review for possible downgrade, reviving fears of contagion in the euro zone debt crisis.
Weak economic data also weighed on equities. Canada's economy unexpectedly shrank in May, with gross domestic product falling 0.3 percent from a month earlier. It was the largest drop since a matching decrease in May 2009. [ID:nN1E76S093]
South of the border, GDP data showed the U.S. economy stumbled badly in the first half of this year and came dangerously close to contracting in the January-March period. [ID:nCAT005481]
Helping to offset losses, Bombardier (BBDb.TO) was up 2.12 percent at C$5.78 after Korean Air said on Thursday it would buy 10 CS300 aircraft for $675 million. [ID:nS6E7IC008]
Fairfax Financial (FFH.TO) rose 1.6 percent to C$376.00 after reporting a higher quarterly profit late on Thursday. [nN1E76Q249]
Maple Leaf Foods (MFI.TO) was up 4.5 percent at C$11.49. On Thursday the food processor said it had adopted a shareholder rights plan and that its chief executive would acquire nearly a third of its shares, prompting speculation a takeover attempt could be in the works. [ID:nS6E7IC008]
($1=$0.95 Canadian) (Reporting by Trish Nixon; editing by Peter Galloway)