* TSX rises 0.87 percent to 10,304.42, up for 4th day
* Materials up 1.4 pct, supported by takeover talk
* Nexen weighs but energy sector pushes ahead (Adds closing figures, quotes)
By Ka Yan Ng
TORONTO, July 16 (Reuters) - Toronto's main stock index finished higher for a fourth-straight session on Thursday, closing at a two-week high, as firmer commodity prices boosted the heavyweight resource sectors.
Takeover talk in the potash patch and rising gold prices encouraged strength in the materials group, which rose 1.4 percent, spurring gains by fertilizer stocks.
Meanwhile, a number of other companies have been scouting for potash assets, and earlier on Thursday Athabasca Potash Inc API.TO said it was mulling a possible sale of all or part of the company. [ID:nBNG199332]
The S&P/TSX composite index .GSPTSE closed up 88.96 points, or 0.87 percent, at 10,304.42. Nine of the TSX's 10 main groups were higher.
"Confidence is returning to the markets," said Elvis Picardo, analyst and strategist at Global Securities in Vancouver.
"A lot of the enthusiasm is based on some of the earnings reports that we're seeing come out of the U.S., not so much Canada. That seems to be lending credence to the theory that we are coming out of the recession here."
Canada's earnings season begins in earnest next week.
Surprisingly strong growth in China in the second quarter made it the best-performing major economy and reinforced hopes it may lead the world out of its deepest economic downturn in 80 years. [ID:nSP537580]
But, while hopes are rising for an economic recovery, some were still preparing for setbacks.
"Going forward, I think that people are going to be worried about how fast this recovery might in fact be. We're certainly bound to hit a few setbacks between now and the end of the year," said Michael Sprung, president of Sprung & Co. Investment Counsel.
"I would suggest people should be prepared for more volatility," Sprung said.
"What we've seen in the last week or so is a market that is desperately trying to see good news, so it's been reacting to that ... I think it's also going to react quite violently to bad news as well."
The TSX began the session slowly, partly because investors pocketed gains a day after the composite index soared nearly 230 points to its highest level in more than a week.
It was also dragged down by oil company Nexen Inc NXY.TO, which reported a 95 percent plunge in quarterly profit. Nexen was the index's biggest heavyweight decliner, finishing the Thursday session down 6.6 percent at C$21.62. [ID:nBNG64586]
But Nexen's weight was offset by a rising oil price that tracked a late-day rebound on Wall Street and pushed up other energy shares in Toronto.
$1=$1.12 Canadian Reporting by Ka Yan Ng; editing by Rob Wilson