Australia's ruling Labor party has backed gay marriage, although Prime Minister Julia Gillard is against it.
The party's national conference also endorsed Ms Gillard's amendment to allow a free vote on any bill aiming to legalise same-sex marriage.
With Labor holding a thin majority over the opposition Liberals, who oppose same-sex marriage, it is unlikely such a bill would succeed.
Australia currently bans gay marriage alhough some states allow civil unions.
The Labor party vote came after an emotional debate from both sides of the issue.
The decision to change the party platform to support same-sex marriage has been hailed as a victory by gay rights campaigners.
"Never doubt how persistent the campaign for equality is," said Finance Minister Penny Wong, who is in a same-sex relationship.
Union leader Joe de Bruyn argued against changing the country's marriage law.
"The definition of marriage as set out in the legislation is that it is the union of one man and one woman, voluntarily entered into for life. It has always been that way since the dawn of humanity," he said.
A private member's bill is expected to be brought before parliament next year.
Ahead of the vote, there were rallies in Sydney, the site of the Labor conference, both for and against gay marriage.
Recent opinion polls indicate a majority of Australians favour allowing such unions.