* TSX up 177.74 points, or 1.45 percent, at 12,407.70 * All 10 main index sectors rise * Energy and mining stocks lead rally By Solarina Ho TORONTO, Oct 16 (Reuters) - Canada's main stock index finished more than 1 percent higher on Tuesday with investor confidence bolstered by stronger-than-expected U.S. earnings, economic data and firmer commodity prices. Mining and energy stocks were up 2.5 percent and 1.75 percent, respectively, as gold and copper prices came off one-month lows. The index's materials group, home to miners, was up 2.08 percent. "For a change, it's a sea of green," said Elvis Picardo, strategist and vice president of research at Global Securities in Vancouver. "When that happens, the TSX does tend to benefit disproportionately. What's been holding the index back for the longest time has been this fear of the many risks out there. "It's basically an improvement on sentiment ... It's a bunch of little things that have come together to contribute to a sharp rise in the TSX." Miner Barrick Gold Corp was the biggest index mover, jumping 3.21 percent to C$39.21, followed by Suncor Energy, which climbed 2.41 percent to C$33.16, and fellow oil producer Canadian Natural Resources, which rose 2.62 percent to end at C$30.89. Gold prices snapped two days of hefty losses, while U.S. crude seesawed its way higher, helped by a fall in the U.S. dollar against the euro and solid gains in U.S. equities. Royal Bank of Canada and Toronto-Dominion Bank completed the top five index movers, with RBC up 1.08 percent at C$57.86, and TD advancing 1.03 percent to C$82.29. The overall financial group was up 1.09 percent. Financials, energy and materials shares make up about three quarters of the index. The market tracked global shares, which rose for a second day, as better-than-expected earnings from U.S. corporate bellwethers Johnson & Johnson and Goldman Sachs Group helped alleviate some concerns about a slowing global economy and raised expectations for the rest of the reporting season. The Toronto Stock Exchange's S&P/TSX composite index ended up 177.74 points, or 1.45 percent, at 12,407.70. All 10 key sectors of the index were in positive territory. Canadian National Railway was also a top gainer, climbing 1.73 percent to C$88.77. The overall industrials group was up 1.4 percent. Valeant Pharmaceuticals International rose 3.11 percent to finish at C$56.96, which helped give a 1.77 percent lift to the index's health sector. Data on Tuesday showed Canadian factory sales bounced back in August with an unexpected 1.5 percent jump after a two-month slump and that foreign investors increased their purchases of Canadian securities in August to C$6.90 billion ($7.04 billion) from C$6.67 billion in the previous month. "Recently some of the data that's come out has been a bit more supportive of the recovery," said Gareth Watson, vice president at Richardson GMP. In corporate news, Loblaw Cos Ltd, Canada's largest grocer, said on Tuesday that it planned to cut about 700 head office and administrative jobs over the next three weeks in a move aimed at reducing costs. Its shares climbed 2.48 percent to finish at C$34.72.