The bill takes effect in mid-August, 27 years after New Zealand decriminalized homosexuality, the New Zealand Herald reported.
"Nothing can counteract the very real negative consequences of not passing this bill. But nothing could make me more proud to be a New Zealander than passing this bill," said Labor Party lawmaker Louisa Wall, the bill's sponsor who is gay. "I thank my colleagues for simply doing what is just, fair and right."
Bill supporters at a Campaign for Marriage Equality party in Wellington cheered loudly and applauded as the measure was passed into law.
At the San Francisco Bath House bar, also in Wellington, the noisy anticipation gave way to silence as the vote was read, the Herald said.
Scott Summerfield, 22, told the newspaper he was thrilled by the bill's passage.
"I just got a text from my mother ... and I was quite thrilled to have her say she thinks I should have the same opportunities as my brother, who's straight, so that's really nice to have that support from my patents," Summerfield said.