The trade gap shrank last month as dairy exports surged.
Imports exceeded exports by $168 million - less than half the deficit financial markets expected.
October's trade balance is always in the red but last month's deficit equated to 4 per cent of exports, the smallest that ratio has been in any October since 1996.
Exports at $4.2 billion were $783 million or 22.6 per cent higher than in October last year, despite a kiwi dollar at 5.6 per cent higher in trade-weighted terms.
Almost all of the increase is explained by a $717 million rise in dairy exports. That included a $626 million increase in milk powder exports, a rise of 133 per cent, which was largely price-driven, though volumes rose 42 per cent.
The trade deficit for the year shrank to $1 billion, from $1.6 billion in the year ended September and $2.1 billion in August.
Over the past year New Zealand achieved a surplus of $745 million in its trade with China, compared with a deficit of $3.9 billion five years ago when the free-trade agreement came into effect.
Forestry exports increased 22 per cent over the past year.
Imports at $4.4 billion were 5.7 per cent higher than in October last year, led by vehicles and mechanical equipment.
In the three months to October, imports of capital plant and machinery were 18 per cent up on the same period last year, which suggests businesses are following through on the intentions to lift investment that they have been reporting to business sentiment surveys for some time.
Car imports were 23 per cent higher.
Imports of consumer goods, by contrast, were up just 3 per cent on a year ago.
Deutsche Bank chief economist Darren Gibbs said that with dairy export revenues likely to continue to surge over coming months he expected the annual trade balance to move well into surplus by the middle of next year.
Together with forthcoming revisions to the historical balance of payments data Statistics New Zealand has signalled, this should mean that the current account deficit falls to around 3 per cent of gross domestic product by mid-2014 - levels last seen during the recession, he said.
"From there we would expect to see the deficit expand gradually as dairy prices recede somewhat from their current exceptionally high levels and as import volumes continue to expand."