Canada’s trade gap narrowed on a gain in energy and aircraft shipments, though overall export volumes continued to decline, clouding the picture on an otherwise better-than-expected result.

The nation posted a $955 million trade deficit in August, from a revised $1.38 billion in July, Statistics Canada said Friday in Ottawa. The result surprised to the upside, beating economist expectations for a $1.2 billion deficit.

Canadian shipments have stabilized this year after suffering a harsh end to 2018 on weak oil exports. Still, economists expect the country's economic growth to slow to 1.5 per cent in the third quarter, partly on global trade tensions, after a 3.7 per cent expansion in the prior period.

Canada’s trade surplus with the U.S., its main trading partner, widened to $4.9 billion in August as export gains outpaced imports. Exports to China expanded despite disruptions to commerce between the two countries amid a diplomatic dispute involving the arrest of a top Huawei Technologies executive on a U.S. extradition request.

Total exports increased 1.8 per cent in August after falling for two consecutive months. Higher exports of business jets to the U.S. led gains in aircraft trade while higher crude oil drove energy product exports. On a volume basis, exports dropped 0.2 per cent.

Metal and non-metallic mineral shipments were the largest contributor to the overall gain in imports in August. Gold imports reached the highest level in more than two years, reflecting an increase in asset acquisitions by Canadian companies.

July’s trade deficit was revised to C$1.38 billion, after an initially reported shortfall of $1.12 billion, the statistics agency said.