The bill which will see abortion removed from the Crimes Act and the legal test for the procedure scrapped has passed its final stage.
The conscience vote about the polarising Abortion Legislation Bill passed its third reading with 68 in favour and 51 votes opposing.
The result was met with applause and a few cheers.
The Abortion Legislation Bill now goes to the Governor General for Royal Assent and will then be law.
• Abortion bill won't go to a public referendum but 'safe zones' might come back
• Abortion referendum scrapped - public won't decide on law change
• Abortion law reform: Extra doctor consultation recommended for later than 20-week abortions
• Voting mix-up sees abortion safe-zones axed and MPs 'gutted'
The Abortion Legislation Bill removes abortion from the Crimes Act and drops any legal test for having the procedure earlier than 20 weeks, leaving the decision up to the woman and her doctor.
The current legal test is for two doctors to approve an abortion only if there was "serious danger" to the woman's physical or mental health.
And for an abortion to take place after 20 weeks, it can only be approved if deemed necessary to save the woman's life or prevent serious injury.
The 68 votes to 51 votes against was the narrowest margin the bill passed any of its readings, with 81 to 39 margin after its second reading and the 94 to 23 margin at the first reading last year.
Already today an amendment to put abortion law reforms to a public referendum was been voted down and an attempt to recommit "safe zones" into the bill failed after they were axed in a voting mix-up last week.
Before the bill was passed this evening it was debated in the House.
Ahead of its third reading, Justice Minister Andrew Little introduced the bill and said if passed it would be the most significant changes to New Zealand's abortion framework in 44 years.
The main point of the bill was to take abortion out of the Crimes Act and make it a health issue, Little said.
He said the issue was "tempered with very deeply held views with great passions" and that the public and members on all sides of the House, some he considered friends, had very entrenched views.
Little said he respected everyone's views and was grateful the "debate was largely conducted in a respectful and I think a very thoughtful manner".
"I think we have to respect the fact that when women are in a position to have to make that decision at that point in the pregnancy, it is a very distressing time indeed.
Little said the bill moved New Zealand's laws into the 21st century to reflect modern views.
It also ensured a woman didn't have to lie about her mental health state in order to have a procedure.
"What we need to make sure is that the support services are there for them, the treatment services, the best professional medical advice they can get, and that is an obligation I think we owe in this day and age."
The arguments for the bill
The Abortion Legislation Committee's chair, Ruth Dyson, said the legislation was long overdue and thanked MPs for their work in taking it through the House.
Though said she regretted the "safe zones" didn't make it into the law.
"I strongly believe that staff at clinics and women accessing services there should not be subject to harassment, to abuse, to intimidation, to humiliation, and to feeling anything other than going through a procedure that is legal and which they're entitled to refer themselves to."
National MP Amy Adams, who worked to drum up support amongst her fellow party members, said she was happy to brand herself a feminist and stand up for women's rights.
"I will feel proud to have done my bit to stand up for the women of New Zealand."
Parliament needed to stay out of women's medical decisions and procedures, she said.
Adams said she was disappointed the 150m "safe zones" were no longer part of the legislation as the protests could be tantamount to psychological abuse.
Labour list MP Kieran McAnulty spoke about the fact he was adopted.
"If I was conceived today, I probably would have been aborted."
He also said his Catholic faith was an important part of his life but he wouldn't let his private faith influence his vote.
"But who am I to push my views and my personal circumstance on the choice of a woman?"
Act leader David Seymour said he supported a woman's right to choose and said it was long overdue for abortion to be taken out of the Crimes Act as criminalising the procedure did more damage than good.
He defended the amendment in his name to have the 150m "safe zones" removed as they were an attack on free speech.
"It would have been a mistake to criminalise abortion while criminalising speech."
Green MP Jan Logie said it was a "really important day" for women in New Zealand.
"It's been a really long time coming. Today I hope we will come out of the sexual and reproductive time warp that we've been stuck in for over forty years."
Logie said it was time for New Zealand, which was considered by many around the world as a feminist Mecca, to catch up with other countries.
The legislation also ensured abortions that would have happened anyway, would happen sooner and women would have more support, she said.
Logie also thanked Little for shepherding the legislation through the House.
Labour MP Marja Lubeck said having an abortion wasn't a decision a woman made lightly.
She spoke about the women who'd been in touch after the bill's first reading when she told the House about her own procedure and said while no one had been prosecuted for having the procedure, they "have carried their abortion as a crime".
"It is not a good reason to stick with offensive, archaic, anti-choice legislation just because people are out there with a loud voice."
Labour MP Michael Wood said the bill wasn't about whether New Zealand had abortion - it was about good and honest law.
He said it was mischievous for politicians to pretend that the issue was around whether the procedures were allowed when about 13,500 took place each year.
The arguments against the bill
National MP Agnes Loheni said the bill was "an attack on our own humanity".
Loheni particularly took opposition to Section 11 which states that a woman who is more than 20 weeks pregnant can only do so if a health practitioner reasonably believes that it was appropriate.
She said the legislation was not good law.
"Who are we and who are we heading as a society if we allow laws which attack our the most sacred instinct has for her unborn child?"
Her speech was met with applause from the public gallery which forced Speaker of the House Trevor Mallard to caution that if anyone intervened, they'd be ejected.
Labour MP Greg O'Connor said while he supported the right to have an abortion, he couldn't support the bill because Section 11 wasn't clearly defined enough.
As a father of a disabled son who would have been eligible to have been aborted under this law after 20 weeks and O'Connor said he couldn't vote in favour of it.
"I would never be part or something that would send women into the back streets," he said.
National MP Simon O'Connor referenced Prime Minister Jacinda Ardern's speech following the March 15 mosque terror attacks.
"They are us and we are them. I've said many, many times before that human rights apply to all humans.
"And I find it sadly sad ... that for people to say they are us and we are them but when it comes to the unborn child, according to those who will support the bill, unborn children are certainly not with us and we are not with them and I condemn this position."
He said he wouldn't support the bill as it gave no rights or dignity to the human child developing.
National MP Andrew Bayly said while the bill was a good piece of legislation for New Zealanders, he couldn't support it.
He was concerned minors would get abortions without their guardians' knowledge, that it permitted the procedure after 20 weeks and that there was an issue with the monitoring of the people who'd conduct the abortions.
National MP Ian McKelvie said his conscious wouldn't let him support the bill because there were still some pieces in it that were "far too risky", despite it broadly being a good piece of legislation.
National MP Chris Penk said it was wrong to suggest the current law criminalised women who got procedures as it instead was the health practitioners who were subject to the Crimes Act.
"Much of the debate from those who have put forward this legislation as supposedly needed to this nation at this time has been founded on the argument that the unborn child deserves no protection under our law - that is wrong."
No public referendum and no safe zones
Already today an amendment to put abortion law reforms to a public referendum was been voted down and an attempt to recommit "safe zones" into the bill failed.
The 150m protest-free areas around abortion clinics were designed to protect women from harassment, intimidation and attempts to breach their medical privacy.
But they were axed last week after MPs supporting them failed to call for individual votes to be counted.
Another attempt to recommit the bill to the committee stage so the "safe zones" could again be debated was also shot down today with 43 in favour and 77 against.
And the attempt to put the issue to a referendum was shot down in a conscience vote during the bill's committee stage this morning by 100 votes to 19 votes.