The measure passed its second reading 77-44 in a late-night vote, the New Zealand Herald reported. It lost only a few votes from its first reading.
Lawmakers rejected a move to delay the bill until after a referendum in 2014, 83-33.
Louisa Walls, the Labor member of Parliament who sponsored the bill, praised those same-sex couples who had come forward to support the legislation.
"The agony and hardship that so many who bravely made submissions have had to face is unreasonable," she said. "But what's totally unacceptable, is the state perpetuating that agony and hardship by not issuing marriage licences to loving, consenting and eligible non-heterosexual couples."
Cheers from the floor and from the packed galleries had to be cut off by the speaker so debate could continue.