It cost the government more than $1 million per insect to eradicate the Queensland fruit fly from Auckland last year.
The Ministry of Primary Industries (MPI) has released the final costs of its eradication programme, which swung into action after the first of 14 flies was found in Grey Lynn last February.
It spent $15.7m eradicating the flies, including setting up hundreds of surveillance traps and collecting fruit and vegetables from houses in the area where the fly was found.
Auckland was declared free of the pest in December.
The ministry said the Queensland fruit fly was a particularly destructive species and could have threatened the $6 billion horticulture industry if it had become established in New Zealand.
The flies were thought to have arrived in the country through illegally imported produce.