Statistics Canada says the country posted a merchandise trade deficit of $137 million in December to end a run of six consecutive monthly surpluses as imports rose and exports fell in the final month of the year.
The result compared with a surplus of $2.5 billion in November.
Imports for December rose 3.7 per cent to a record $57.7 billion, helped by a 16.2 per cent gain in electronic and electrical equipment and parts. Imports of motor vehicles and parts also rose 5.1 per cent.
Meanwhile, exports fell 0.9 per cent to $57.6 billion in December as exports of energy products fell 5.9 per cent.
Crude oil exports fell 5.0 per cent due to a drop in prices, while coal exports dropped 33.5 per cent due to disruptions in freight transportation in B.C. due to the flooding and landslides.
For the full year, Statistics Canada said the country posted an annual trade surplus of $6.6 billion, its first annual surplus since 2014 and largest since 2008.