By having very strict controls.
This piece, New Zealand goes 100 days with no coronavirus community spread – Axios), shows just how strict they are:
By the numbers: New Zealand has 23 active coronavirus cases, all NZ residents newly returned from abroad in managed isolation facilities.
Of note: The border remains closed to non-residents and all newly returned Kiwis must undergo a two-week isolation program managed by the country’s defense force, which sees all travelers tested three times before they leave.
Police are stationed outside hotels where travelers are in quarantine. Officers have taken prosecutorial action against several returned travelers who’ve breached these rules by fleeing the facilities under the COVID-19 Public Health Response Act.
So good for New Zealand for doing this. But I wish people wouldn’t say New Zealand has beaten the coronavirus. What they have done is control it better than anyone.