Lawmakers voted 119-1 in favour of the bill, which bans military-style semi-automatic (MSSA) rifles like those used in the March 15 rampage by a white supremacist which claimed 50 lives.
Police Minister Stuart Nash said the attack by accused gunman Brenton Tarrant showed current firearms restrictions were inadequate.
"Far too many people in this country have access to these dangerous firearms for no legitimate purpose, but at significant risk to the public," he said.
The sole holdout against the legislation was David Seymour, a conservative whose ACT Party has a single seat in parliament.
Seymour criticised the speed with which his colleagues were handling the legislation, fast-tracking a process that usually takes months so that the law will take effect by the end of next week.
"It is important that we maintain our tradition of sober, robust law-making at all times, but especially now," he said in a statement.
"The best way to show defiance in the face of terrorism is to refuse to erode our democratic institutions."
Seymour had intended to try to stall the legislation in parliament but missed his chance when he arrived in the chamber late after spending too long explaining his plan to media.
Nash was unapologetic about the hurried timetable for outlawing MSSAs, which will see the ban put to the vote twice more before it would formally become law.
A look at New Zealand's minority Muslim community
"We don't ever want to see an attack like this in our country again," he said. "We are compelled to act quickly."
Further curbs -- potentially including a gun register, tighter vetting and stricter gun storage rules -- are set to be passed by the end of the year.
New Zealand has about 1.5 million privately owned firearms, or 0.3 per person, including an estimated 13,500 MSSAs
The government has also said it will review laws dealing with hate speech.
New Zealand mosque attacker 'complains about prison treatment'
Prime Minister Jacinda Ardern, widely praised for her compassionate and decisive leadership following the Islamophobic attack, has also called for action by social media giants after the alleged gunman livestreamed the atrocity online.
She has also ordered a judicial inquiry into whether intelligence services could have prevented the attack.
Nash said the largest criminal investigation in New Zealand's history was now probing the country's worst mass shooting.
"Dozens of specialist police investigators, supported by Australian federal and state police, are following up concerns about a number of high-risk individuals," he told parliament.
"As we meet today, a number of people are before the courts for trying to promote hateful publications and videos of death; for unlawfully possessing weapons; for making threats against our citizens, and, for murder."
Tarrant was apprehended soon after his killing spree and the 28-year-old Australian is due to appear in Christchurch High Court on Friday via video link from an Auckland prison.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ