The bill, which was introduced by the government last year, passed with 112 votes in favor and eight votes opposed.
“This is a great day for New Zealand’s rainbow communities,” Minister of Justice Kris Faafoi said.
The government has said practices such as conversion therapy do not work, are widely discredited and cause harm.
The legislation also lays out what is not conversion practice and protects the right to express opinion, belief, religious belief or principle which is not intended to change or suppress a person’s sexual orientation, gender identity or gender expression.
The government said it had received nearly 107,000 public submissions on the bill, the highest number of public submissions ever received on any legislation.
Under the legislation, it will be an offense to perform conversion practices on a child or young person aged under 18, or on someone with impaired decision-making capacity. Such offenses would be subject to up to three years imprisonment.
It will also be an offense to perform conversion practices on anyone — irrespective of age — where the practices have caused serious harm, and offenders can be subject to up to five years imprisonment.
Laws against conversion therapy have been gaining momentum around the world. Canada’s parliament voted unanimously last year to ban LGBT conversion therapy.
The United States does not have a federal ban on conversion therapy, but several US states, including California, Colorado, New York, Washington and Utah, prohibit the practice to some degree.
Aimed at changing a person’s sexual orientation or gender identity, conversion therapy can include talk therapy, hypnosis, electric shocks and fasting. In extreme cases, exorcism and “corrective rape” for lesbians, have been documented.
Ending conversion therapy was one of New Zealand Prime Minister Jacinda Ardern’s campaign promises when she was elected for a second term last year.