Exports exceeded imports by $129 million or 3.6 per cent last month, the first July trade surplus for 20 years.
The annual trade balance was a surplus of $1.3 billion, up from $1 billion in the year ended June.
Exports at $3.7 billion were up 4.7 per cent on July last year, dairy products accounting for nearly half of the increase.
Imports at $3.6 billion were 4 per cent lower on a year ago, lower imports of oil and petroleum products accounting for two-thirds of the difference. Oil shipments are large and irregular and can blow the monthly trade numbers around.
For the three months ended July, exports were 6.5 per cent higher than in the same period last year. This was an impressive increase given that the dollar rose 5.2 per cent in the interval, lowering the domestic price received for exports, Infometrics economist Matt Nolan said.