TORONTO - The Toronto stock market closed modestly higher Tuesday as Scotiabank (TSX:BNS) delivered quarterly earnings that beat expectations and mining stocks continued to recover from sharp losses racked up earlier this month.

Focus quickly switched to Research In Motion Ltd. after the close. Shares in the BlackBerry maker were halted as RIM announced it has hired J.P. Morgan Securities LLC and RBC Capital Markets to advise on a review of the Waterloo, Ont.-based company's business and financial performance.

RIM also said it expects to report an operating loss for the first quarter. RIM's shares finished Tuesday trading up nine cents to $11.48, its lowest level since late 2003. In after-hours trading on the Nasdaq, its stock was down 11.8 per cent or 1.33 to US$9.90.

The S&P/TSX composite index came down from a 121-point runup to rise 43.15 points to 11,609.3 while the TSX Venture Exchange dropped 15.67 points to 1,309.34.

Scotiabank's second-quarter profit was $1.46 billion or $1.15 per diluted share. That was down from a year ago, when Scotiabank's bottom line was helped by special items but still slightly ahead of analyst estimates.

Adjusted earnings were $1.18 per share, three cents higher than the consensus estimate of analysts compiled by Thomson Reuters and its shares gained $1.21 or 2.38 per cent to $52.

The Canadian dollar was up 0.08 of a cent at 97.76 cents US.

The TSX fell from its best levels of the day after reports that ratings agency Egan-Jones has downgraded Spain's credit rating to BB-minus from B.

Worries about Greece have receded somewhat after weekend polls showed Greek pro-austerity parties holding a narrow lead ahead of elections slated for June 17.

But there are increasing worries about Spain and its banking sector after the country's fourth-largest lender, Bankia, said Friday that it needed C19 billion in bailout money, raising questions as to where Spain could find the money for such an infusion.

Traders in turn have demanded higher yields to buy Spanish government debt and the yield on the government's 10-year bonds rose Tuesday to 6.5 per cent, close to the seven per cent mark which is seen as unsustainable.

Investors fear that the Spanish government, which is already under pressure to lower its debt at a time of recession and record-high unemployment, will be overwhelmed by the cost of saving the country's banking sector.

"Greece is just a small aspect of (the government debt crisis)," said Monika Skiba, senior portfolio manager at Manulife Asset Management.

"The bigger issue is the periphery. The important aspect is the domino effect. At some point you have a risk of a run on the banks and we have to assign more meaningful probabilities to this event than we did say, three or four months ago."

U.S. markets were also higher as traders balanced data showing a steadily recovering housing sector with a poorer-than-expected reading on consumer confidence.

The Standard & Poor's/Case-Shiller home price index showed that home prices rose in March from February in most major U.S. cities for the first time in seven months. Prices increased in 12 of the 20 cities it tracks.

However, the Conference Board said its Consumer Confidence Index came in at 64.9 for May, down from a revised 68.7 in April. Economists had been expecting a reading of 70.

The Dow Jones industrial average ran ahead 125.86 points to 12,580.69.

The Nasdaq composite index gained 33.46 points to 2,870.99 while the S&P 500 index was ahead 14.6 points at 1,332.42.

Commodity prices were mixed amid rumours that China will relax monetary policy and announce fiscal stimulus measures to offset slowing economic growth.

"And if China's easing will be successful, we will have much better global growth," Skiba said.

"We do need more than just the U.S. domestic demand improving. We need to have Europe, we need to have China for the world to be a happy place again."

China's huge appetite for oil and metals has been a primary driver for higher commodity prices and resource stocks on the TSX.

However, prices for crude and copper, along with resource stocks, have taken a beating over the last couple of months on worries the global economic recovery is losing momentum. For example, the TSX materials and energy indexes have plunged about 10 per cent this year and oil and copper prices have sunk to multi-month lows.

The July copper contract added one cent to US$3.46 a pound, taking the base metals sector up 1.79 per cent. Teck Resources (TSX:TCK.B) rose $1.18 to C$32.51.

The TSX energy sector rose 0.94 per cent as the July crude contract on the New York Mercantile Exchange gave up early gains to slip a dime to US$90.76 a barrel. Suncor Energy (TSX:SU) gained 29 cents to C$29.19.

Ithaca Energy Inc. (TSX:IAE) shares plunged $1 or 35.34 per cent to $1.83 on very heavy volume of almost 35 million shares a day after the energy company announced it has ended talks with all parties interested in the potential acquisition of the company.

Scotiabank's performance helped push the financial sector up 0.88 per cent with TD Bank (TSX:TD) 78 cents higher at $78.90.

The gold sector fell about 2.4 per cent while the June bullion contract in New York fell $20.20 to US$1,548.70 an ounce. Barrick Gold Corp. (TSX:ABX) faded $1.50 to C$39.74.

Shares in Kinross Gold Corp. (TSX:K) lost 14 cents to $8.28 after the miner said it is selling its 50 per cent interest in Crixas gold mine in Brazil to AngloGold Ashanti of South Africa for US$220 million.

Meanwhile, Facebook's stock dropped again, plunging $3.07 or 9.62 per cent to US$28.84, close to the lows of the day, on heavy trading of 77 million shares. The stock has dropped 26 per cent since it began trading May 18 with an IPO price of US$38.