Statistics Canada released the trade data on Thursday. Canada's trade deficit narrowed to C$0.53 billion in July from a deficit of C$0.81 billion in June. June's figure was revised down from a deficit of C$0.48 billion.
Analysts had expected a trade deficit of C$1.3 billion.
The decrease in deficit was driven by an increase in exports. Exports increased 2.3% in July.
Exports of energy products dropped by 5.7% in July, exports of consumer goods jumped 7.3%, exports of motor vehicles and parts soared 9.9%, while exports of aircraft and other transportation equipment and parts were up 19.2%.
Imports climbed 1.7% in July.
Imports of aircraft and other transportation equipment and parts jumped by 22.9% in July, imports of metal and non-metallic mineral products dropped 9.6%, while imports of energy products soared 12.9%.