The S&P/TSX composite index added 5.79 points to 12,436.5, turning around earlier losses of as many as 50 points. The junior TSX Venture Exchange added 6.9 points to 1,577.6.
About half of the sectors on the main index were in the red, with the energy and mining sectors weighing on the index. The heavyweight financial sector turned around late in the day to close positive, with shares in TD Bank (TSX:TD) up 38 cents to $83.60.
The Canadian dollar reversed earlier gains to shed 0.05 of a cent to 100.78 cents U.S. after losing nearly half a cent Tuesday.
Traders reacted to some mildly disappointing news on U.S. home sales, an important gauge for Canadian resource, construction and manufacturing companies that have ties to the housing market south of the border. But, sentiment improved amid a rebound in commodity prices.
The U.S. National Association of Realtors said home sales fell 0.9 per cent last month to a seasonally adjusted annual rate of 4.59 million. Economists had expected a February gain of 0.9 per cent.
The lower sales followed an upwardly revised 4.63 million in January, which marked the highest level since May 2010.
"Although existing home sales did decline (month over month), this was relative to a stronger-than-expected upward revision back in January ... we've seen a significant improvement in economic newsflow over the last few months, specifically in the U.S." said Candice Bangsund, a portfolio manager at CWM Investment Counsel Inc.
"The employment recovery appears to be underway, which is supporting consumer confidence/spending as well as housing affordability. Rock-bottom interest rates have also spurred demand for housing in the U.S. All in all, we believe that the housing market is in the process of bottoming, supported by the favourable economic landscape in the U.S."
Wall Street closed in the red with the Dow Jones industrials average down 45.6 points at 13,124.6 and the broader S&P 500 index shedding 2.6 points to close at 1,402.89.
The Nasdaq composite rose 1.17 points to 3,075.3 following a positive earnings report from business software firm Oracle after market closed Tuesday.
Gold added $3.30 to US$1,651.10 an ounce, while copper moved up two cent to US$3.85 a pound. On the TSX, shares in Barrick Gold Corp. (TSX:ABX) shed 19 cents to C$43.28, while shares in miner Teck Resources (TSX:TCK.B) were down four cents to C$35.70.
The May crude oil contract was up $1.20 at US$107.27 a barrel. Still, the energy sector on the TSX moved lower, with shares in Imperial Oil (TSX:IMO) down 33 cents to C$45.39.
Saudi Arabia, the world's largest crude producer, said Tuesday that it can quickly boost output by 25 per cent if there is a sudden disruption in global supplies. Crude has jumped from $75 in October as traders have worried a conflict over Iran's nuclear program could interrupt supplies.
In Canadian data, Statistics Canada said its composite leading index, which offers a snapshot of the health of the economy, rose 0.6 per cent in February, after rising 0.4 per cent in January. It was the eighth consecutive monthly increase in the index, with six of its 10 components rising.
On the corporate front, Montreal-based Miranda Technologies Inc. (TSX:MT) is talking with a number of unnamed strategic partners about ways to enhance the company's value, while making a change on its board. Its shares jumped 15 per cent or $1.58 to $12.22.
Shres in SNC-Lavalin (TSX:SNC) lost 27 cents to close at $38.65 after the company said it has signed $133-million project management contract with Petroleos de Venezuela S.A. for the Delta Caribe Oriental project.
In a report Wednesday, Goldman Sachs analysts urged investors to dump bonds and put money into stocks. The report argues the weak economic growth in the United States and Europe is not universal, and that the 2010s could be the strongest period for world growth between 1980 and 2050.
Also on Wednesday, U.S. Federal Reserve chairman Ben Bernanke said stress tests showed the United States' largest banks could withstand shocks from Europe, even if the debt crisis there significantly worsened.
Bernanke told the House Oversight and Government Reform Committee that the U.S. banking system remains exposed to Europe.
Over the past few weeks, stocks have been buoyant as U.S. economic figures were upbeat and concerns over Europe's debt crisis eased. Many stock indexes are trading at multi-month highs, while the main U.S. markets at their highest levels in nearly four years.