The bill, which enables terminally ill people to request a medically assisted death, was passed 69-51 in parliament, after several amendments and years of heated debate.
Previous attempts by legislators to legalise euthanasia have failed, and when the bill was introduced in parliament again in 2017 it was met with several concerns, including the possible vulnerability of elderly patients being coerced.
The bill has since been amended with what its sponsors say are safeguards, including a requirement that patients be diagnosed as having less than six months left to live.
The patient must be the first to suggest assisted dying, and two doctors must agree the patient is well-informed and other legal criteria are met.
The politician behind the bill, David Seymour of the libertarian ACT Party, said people who are genuinely concerned have absolutely nothing to fear as there are robust safeguards in place.
“It is entirely about choice. Just as their rights and choices are respected, they will also need to respect the choices of others,” Seymour said.
The fate of the law rests in the hands of New Zealanders who will vote in a referendum at the general election, which must be held by November next year.
The public will also be voting in a referendum over legalising recreational cannabis.
Recent polls have indicated a majority support the measure to legalise euthanasia.
However, there has also been strong resistance from faith-based organisations, medical professionals and others. The bill received 39,000 public submissions, most opposing it.
Opposition National Party politician Maggie Barry called it a “dangerous and permissive bill” and said it was important to stop it through the referendum.
Dozens of protesters opposing the law gathered outside Parliament on Wednesday holding placards that said “assist us to live, not die” and “euthanasia is not the solution”.
Many countries have legalised euthanasia, including Canada, the Netherlands, Switzerland, and some US states.