OTTAWA – Canada posted its first trade surplus in five months in February — only the third in more than two years — but the rare feat still leaves the key export sector in the hole so far this year.

Statistics Canada reported Thursday that exports rose by 3.6 per cent and imports by a weaker 2.1 per cent, producing a tiny surplus of $290 million for the month, after a $337-million shortfall in January.

A weaker loonie and higher energy prices contributed to the better-than-expected surplus, as export volumes only rose by 2.2 per cent.

But analysts noted the resurgence in February only went half-way toward recouping a drop in real exports in January that was partially attributable to seasonal plant shutdowns.

“What we can say is, it’s going in the right direction,” said Benjamin Reitzes, a senior economist with the Bank of Montreal, “but we’re not where we want to be yet.”

There were some encouraging signals, however. The critical auto sector posted a 9.7 per cent increase in shipments, aircraft a 13.7 per cent jump and energy gained 4.3 per cent. Energy exports were the third highest on record in February, contributing to a $7.3 billion energy trade surplus.

In total, exports rose to $42.3 billion, while imports grew to $42.1 billion. Shipments to the U.S. increased by 4.4 per cent to $32.4 billion, while exports to the rest of the world were up only 1.1 per cent to $9.9 billion.

Another encouraging sign was that imports of machinery and equipment rose 4.4 per cent and are up 12.3 per cent over the past year, suggesting businesses may be gearing up to increase capacity.

The Bank of Canada has indicated a revival of Canada’s export performance is necessary for a sound and sustainable recovery, because it will create more jobs and also infuse businesses with confidence to invest in new plant and machinery.

For that to happen, the central bank says Canada must be in position to take advantage of the resurgence in U.S. demand as the economy south of the border improves.

A pick-up of shipments to the United States is starting to happen, analysts say, but not quickly enough or as soon as expected. A research paper issued earlier this week by the CIBC argues one of the reasons is that there are fewer companies around to export, noting about 20 per cent of exporting firms in Canada have disappeared.

Still, the combination of a weaker loonie — which has seen a 10 per cent devaluation over the past year — and a stronger U.S. economy now projected to grow in the three per cent range should translate to more demand for Canadian goods, said TD Bank economist Leslie Preston.

“Short-term disruptions aside, today’s number is further evidence that a strengthening U.S. economy is helping to lift export activity in Canada,” she said in a note to clients. “We expect net exports to make a solid contribution to growth through the remainder of the year.”

For 2013 as a whole, Statistics Canada said exports rose a moderate 1.6 per cent in terms of volumes, which are directly related to gross domestic product growth.