Overall imports rose to $39.7 billion as exports were mostly unchanged at $38.9 billion from a month earlier, the report said.
The main spike in imports was from the energy sector, including a 7.2 percent increase in crude petroleum to $2.7 billion "in anticipation of temporary shutdowns for maintenance," the agency said.
For exports, gains in the machinery and equipment sector nearly offset widespread decreases in other sectors, rising 8.7 percent to $7.3 billion.
Reporting separately on trade between Canada and the United States, one another's largest markets, the agency said Canada's trade surplus with the United States decreased from $3.6 billion in April to $3.2 billion in May.
"Imports from the United States rose 1.8 percent to $25 billion in May," StatsCan said. "After four consecutive monthly decreases, exports to the United States edged up 0.2 percent to $28.2 billion."