New Zealand has become the first country in the Asia Pacific region to legalise same-sex marriages after its parliament voted overwhelmingly to extend the right to tie the knot to gay and lesbian couples.

Members of parliament voted to allow an amendment to the 1955 Marriage Act by 77 votes to 44.

Cheers and applause erupted in the parliamentary public gallery when the result was announced.

"Yay, we did it," said Louisa Wall, the openly gay opposition Labour Party MP who promoted the bill.

"I have longed for this for a very, very long time. My only sadness is that both of my parents have now passed and it would have been such a huge joy to have them at my wedding," said openly gay Green MP Kevin Hague, who has been with his partner for nearly 20 years.

The bill was widely expected to pass, given similar support for the change in a preliminary vote held last month. It is likely to come into effect in August.

New Zealand becomes the 13th country to legalise same-sex marriages, after Uruguay passed its own law last week. Australia last year rejected a similar proposal.

Countries where such marriages are legal include Canada, Spain and Sweden, in addition to some states in the US.

The bill was opposed by the Catholic Church and some conservative religious, political and social groups, which campaigned that it would undermine the institution of the family.

The law makes it clear that clergy can decline to preside in gay marriages if they conflict with their beliefs.

The law to allow same-sex marriages comes after New Zealand gave same-sex relationships partial legal recognition in 2005 with the establishment of civil unions.