Statistics Canada says the country posted a merchandise trade surplus of $769 million in July as exports fell for the first time in six months.
The agency says the result compared with a surplus of $4.2 billion in June.
The July surplus came as total exports fell 2.3% to $76.1 billion for the month, as exports of metal and non-metallic mineral products declined 8.5%.
Exports of energy products dropped 4.4% as exports of crude oil were down 5.6% amid lower prices and volumes.
Meanwhile, imports rose 2.2% to $75.4 billion, boosted by an 11.4% increase in imports of motor vehicles.
In volume terms, exports fell 1.5%, while imports rose 2.2%.