Statistics Canada says the country posted a merchandise trade surplus of $684 million in July.
The result compared with a revised deficit of $179 million in June. The initial reading for June had shown a surplus of $638 million.
In July, Statistics Canada says imports fell 1.7% to $65.0 billion.
Imports of motor vehicles and parts fell 10.8% as imports of passenger cars and light trucks fell 18.7% after hitting a record high in June.
Exports edged down 0.4% in July to $65.7 billion as exports of motor vehicles and parts declined 5.4%.
In volume terms, imports fell 2% in July, while exports decreased 1.5%.