Statistics Canada says the country posted a merchandise trade deficit of $1.1 billion in July compared with a revised deficit of $55 million June.
Economists had expected a deficit of $400 million, according to financial markets data firm Refinitiv.
The result for June was updated from what was originally reported as a $136-million surplus.
Statistics Canada says imports rose 1.2 per cent to $50.9 billion in July, with gains in six of 11 sectors.
Imports of consumer goods were up 2.4 per cent, while aircraft and other transportation equipment and parts rose 10.2 per cent.
Total exports fell 0.9 per cent to $49.8 billion in July as energy product exports fell 6.7 per cent in July due to a 7.7 per cent drop in crude oil exports.