The government has pushed through its second tranche of firearms changes promised in the wake of last year's Christchurch shootings.
The legislation passed its third and final reading this afternoon with the support of Labour, New Zealand First and the Greens.
It paves the way for a gun register and a warning system to show if a licence holder is a fit and proper person
Police Minister Stuart Nash said the new law is designed to stop firearms falling into the wrong hands.
Nash said today marks an historic milestone for community safety.
Last year, a law making most semi-automatic firearms illegal passed with near-unanimous political support in the wake of the mosque attacks that left 51 people dead.
The second tranche of law reform had divided Parliament and time had been running out to get it through the House before the election.
However after months of negotiation with New Zealand First, Police Minister Stuart Nash got the numbers to progress the reforms.
The changes include loosened restrictions for farmers wanting to use prohibited firearms for pest control and the establishment of an independent entity to take over firearms licensing and administration.
New Zealand First MP Ron Mark had been doing much of the negotiating and said his party pushed as far as it could to make changes to the bill.
"It is no secret New Zealand First has been a very strong supporter of responsible firearms owners for a very long time, but you know 51 people are dead, 50 people have had their lives changed irreversibly," he told RNZ earlier in the week.
National Party police spokesperson Brett Hudson this week said gang members who committed firearms offences weren't licensed, so it was "pure tripe" that the bill would keep guns out of their hands.
Hudson criticised the conditions required for farmers to be allowed to use prohibited firearms for pest control.