Exports for the month were $4.2billion and imports were $4.3billion when the market expected $4.05billion and $4billion respectively.
The monthly balance was a deficit of $60million in June compared with expectations of $100million.
BNZ senior economist Craig Ebert said it did not matter New Zealand registered a small trade deficit when the market was looking for a surplus.
''Aside from it being a small miss in absolute terms, the real story is that it is the net consequence of exports and imports each beating market expectations by quite some margin.''
The increased exports meant annual growth of 1.3% overall and 2.9% for shipments to China.
While that might not sound like much, it came despite a 29% fall in the total export value of milk powder, butter and cheese exports.
''This is not for a moment to downplay the very tough times the dairy industry is staring at, with much of the economic impact of this yet to hit.
''But the latest trade numbers also highlight there is obviously strong growth occurring in non-dairy exports, even to China.''
China's share of New Zealand's dairy exports had halved to 18% in the year ended June, Mr Ebert said.
Its share of beef exports had grown to 11% from a mere 1% three years ago.
''We are also reminded of the driving force China is providing in respect to short-term visitor arrivals to New Zealand's shores.''
Looking at goods exports to all countries, and smoothing over the three months to June, the export value of meat rose 11% on a year ago.
Seafood increased 9%, wool went up 9%, mechanical machinery and equipment expanded 14%, electrical machinery and equipment rose 19%, wine lifted 15%, wood pulp and waste paper rose 14% and fruit surged 28%.
The latest numbers were just starting to reflect the weakened exchange rate, he said.
''Just wait until the foreign exchange cover - typically higher among exporters than importers - rolls over.''
The strong investment story for New Zealand was ''right back on the rails'', according to the June figures, Mr Ebert said.
Excluding the 22% fall in crude oil and controlling for lumpy transport items, mainly big aircraft, the value of June's imports was up 18% on a year ago.
That was not consistent with a slowing down in domestic demand and/or little sign of future price pressure.
Overall, the trade data said good things about the second-quarter gross domestic product growth and for momentum going into the third quarter, he said.