Teck Resources Ltd (>> Teck Resources Ltd) rose 5.5 percent to C$30.68 as European coal futures rose due to a disruption of coal exports caused by rail line damage in northeast Australia from Cyclone Debbie, which struck last week. Teck is a producer of steelmaking coal.

Teck helped the materials group <.GSPTTMT> climb 1.7 percent, making it the best performing sector on TSX. Gold producers also rallied along with the price of gold, including Barrick Gold (>> Barrick Gold Corp), which advanced 2.3 percent to C$25.85, and Agnico Eagle Mines (>> Agnico Eagle Mines Ltd), which rose 3.3 percent to C$58.30.

The market vacillated between positive and negative territory during the session and the TSX will likely stick to its recent trading range until earnings season starts in the coming weeks, said John Kinsey, portfolio manager at Caldwell Securities Ltd.

The Toronto Stock Exchange's S&P/TSX composite index <.GSPTSE> ended up 36.65 points, or 0.24 percent, at 15,584.40. Of the index's 10 main groups, half were in positive territory.

SNC-Lavalin Group Inc (>> Snc-Lavalin Group Inc) gained 0.8 percent to C$52.58, after rising as much as 2.3 percent after the company offered to buy WS Atkins (>> WS Atkins PLC) for about 2.1 billion pounds ($2.62 billion).

Enbridge Inc (>> Enbridge Inc) was among the biggest drags on the market, declining 0.4 percent to C$55.49. The energy group <.SPTTEN>, which retreated 0.2 percent, tracked oil prices which were pressured by a rebound in Libyan oil output. U.S. crude prices settled down 36 cents at $50.24 a barrel. [O/R]

Magna International Inc (>> Magna International Inc.) also weighed on the index, sliding 2.2 percent to C$56.14 and helping push the consumer discretionary group down 0.6 percent.

Other consumer stocks also came under pressure, including Loblaw Cos Ltd (>> Loblaw Companies Limited), which was down 0.8 percent at C$71.61, and Dollarama Inc (>> Dollarama Inc), which fell 1.0 percent to C$109.12.

In economic data, Canadian business was more optimistic about future sales and exports, and plan to boost hiring and investment to meet demand despite uncertainty about U.S. protectionism, according to the Bank of Canada's quarterly business outlook survey.

Advancing issues outnumbered declining ones on the TSX by 127 to 121, for a 1.05-to-1 ratio on the upside. The index posted eight new 52-week highs and no new lows.

(Reporting by Solarina Ho in Toronto and Leah Schnurr in Ottawa; Editing by Matthew Lewis)