* TSX ends up 138.49 points, or 1.07 percent, at 13,104.98
* All 10 of the main groups are higher (Updates to close, adds details, comments)
By Claire Sibonney
TORONTO, June 28 (Reuters) - Toronto's main stock index ended sharply higher on Tuesday as heightened optimism that the Greek debt crisis would be resolved boosted commodity prices and investor confidence.
Hopes that Greece can push an unpopular austerity program through parliament on Wednesday and avoid becoming the first sovereign default in the euro zone prompted investors to flock to riskier assets, despite violent street protests in Athens against spending cutbacks. [MKTS/GLOB]
The index's energy group led advances, jumping 1.8 percent as oil prices rallied. The index's top three most influential gainers were in the group: Canadian Natural Resources (CNQ.TO) surged almost 3 percent to C$39.44, Suncor Energy (SU.TO) advanced 1.5 percent at C$37.52, while Cenovus Energy (CVE.TO) rose 3.6 percent to C$34.61.
"I think it all hinges on Greece now," said Elvis Picardo, strategist and vice president of research at Global Securities in Vancouver.
"This is a problem that has transfixed the markets for quite a few weeks and just based on the latest action it does seem like investors are optimistic that the package will pass and that we will be able to avert a wider potential catastrophe."
The Toronto Stock Exchange's S&P/TSX composite index .GSPTSE ended up 138.49 points, or 1.07 percent, at 13,104.98. All 10 of the index's main groups were higher, including the weighty materials sector, up 1.4 percent, and financials, up 0.6 percent.
In individual company news, SNC-Lavalin Group (SNC.TO) rose 1.6 percent to C$56.64 after a Globe and Mail report said the Canadian government was set to announce the sale of Atomic Energy of Canada to SNC, Canada's biggest engineering firm. [ID:nN1E75R0OG]
Shares of Westport Innovations WPT.TO, which announced it was developing a new natural-gas engine technology with General Motors, jumped more than 10 percent to C$23.55. [ID:nL3E7HS27R]
On the downside, Yellow Media YLO.TO was one of the index's biggest decliners, extending Monday's dramatic losses and falling another 4.6 percent to C$2.28 on worries over the telephone directory publisher's struggle to transform from print to digital. [ID:nL3E7HS2DZ]
($1=$0.98 Canadian) (Reporting by Claire Sibonney; editing by Peter Galloway)