After a dismal second quarter Canada's economy showed signs of life in July as higher exports almost halved the trade deficit and the value of building permits hit a record high.

Canada came through the recession in better shape than most major industrialized nations but a weak export sector, as well as the after-effects of the Japan earthquake and fires in energy-rich Alberta, shrank the economy slightly in the second quarter.

In a sign that the impact of the one-off problems that weakened the economy in that quarter was starting to fade, Statistics Canada said on Thursday that exports rose 2.2 percent in July, cutting the trade deficit to C$753 million ($768 million) from C$1.37 billion in June.

Analysts had forecast the July deficit would be C$1.22 billion.

This report does provide some optimism for a rebound in the third quarter, following the considerable drag from net exports in the second quarter, said TD Securities strategist Mazen Issa.

Now that the temporary factors have largely dissipated, the big question remains how U.S. demand will shape up over the coming months.

The United States is by far Canada's biggest export market.

The Bank of Canada said on Wednesday it expected net exports to remain a major source of weakness, reflecting more modest global demand and the persistent strength of the Canadian dollar.

July imports advanced by 0.5 percent, pushed up by a 5.8 percent gain in automotive products and a 6.1 percent increase in energy products as some refineries resumed production.

Even with these numbers I would say one month does not a trend make. We need much more substantial evidence of a turnaround before we can get very happy about our second-half situation, said Peter Hall, chief economist at Export Development Canada.

Exports to the United States rose 2.1 percent in July, while imports were up 3.1 percent. The bilateral trade surplus slipped to C$3.37 billion from C$3.54 billion in June.

The Canadian dollar was little changed as markets focused more on statements by key central bankers than on the Canadian economic data..

At 10:10 a.m. (1410 GMT), the Canadian currency was at C$0.9847 to the U.S. dollar, or $1.0155, compared with Wednesday's close of C$0.9855, or $1.0147.

Separately, Statistics Canada said the value of building permits jumped by 6.3 percent to C$7.0 billion in July, matching a record set in May 2007.

It also said new home prices edged up 0.1 percent in July from June, following an advance of 0.3 percent in June.

Arguably, the big positive surprise for the Canadian economy in 2011 has been the resilient housing market, said Doug Porter of BMO Capital Markets Economics.

Low interest rates are helping fuel the hot housing market, prompting some analysts to fret about a possible bubble.