New Zealand's parliament has legalised same-sex marriage, the first country in the Asia-Pacific region to do so.
Lawmakers approved the bill, amending the 1955 marriage act, despite opposition from Christian lobby groups.
The bill was passed with a wide majority, with 77 votes in favour and 44 against.
Hundreds of jubilant gay-rights advocates celebrated outside parliament after the bill was passed, calling it a milestone for equality.
People watching from the public gallery and some lawmakers immediately broke into song, singing the New Zealand love song "Pokarekare Ana", AP news agency reported.
Some opinion polls have suggested that about two-thirds of New Zealanders support the reform, although others polls suggest the public are more divided.
Parliamentarians were allowed a conscience vote, and, crucially, the reform had the backing of both the Prime Minister John Key and leader of the opposition David Shearer, the BBC's Phil Mercer in Sydney reports.
Celebrations have been held in pubs and clubs in the capital Wellington, our correspondent adds.
Same-sex civil unions have been legal in New Zealand since 2005.
"In our society, the meaning of marriage is universal - it's a declaration of love and commitment to a special person," Labour MP Louisa Wall, who introduced the legislation, said.
"Nothing could make me more proud to be a New Zealander than passing this bill," she added.
Drag artist Jake Andrew said he learned of the news at a club in Hamilton.
"We cheered, yelled, cried and sang - it was just amazing," he told the BBC.
"I am so happy, not only because I can now marry the person I love, but because New Zealand has moved a step further towards gay and lesbian people becoming completely equal with the rest of our society."
Tania Bermudez and Sonja Fry, a same-sex couple, said the bill was about human rights.
"It means that we can actually call each other wife," Ms Fry said.
However, Conservative Party leader Colin Craig said there were many people who disagreed with the bill.
"We're seeing the politicians make a decision tonight that the people of this country wouldn't make," he said.
Bob McCoskrie, founder of the lobby group Family First, said the bill undermined the traditional concept of marriage.
"Historically and culturally, marriage is about man and a woman, and it shouldn't be touched," he said.
New Zealand becomes the 13th country to legalise same-sex marriage.
Other countries include the Netherlands, Belgium, Spain, Canada, South Africa, Argentina and Uruguay.
French and British lawmakers have also voted in favour of legislation allowing gay marriage, although the bills have not yet been passed into law.
No other country in the Asia-Pacific region allows gay marriage.
Australian members of parliament overwhelmingly voted against a bill that would have legalised same-sex marriages in September. However, some states allow civil unions for same-sex couples.
China does not allow gay marriage. However, transsexuals who have undergone surgery are able to marry someone of the opposite sex, provided their new gender is verified by the local public security authorities.