Legislation to legalise same-sex marriage has passed through both houses of parliament without amendments, almost a month after Australians voted 'Yes' in a national survey.
Same-sex marriage could be legal as soon as Friday after a bill to change the Marriage Act passed the House of Representatives.
The Lower House chamber erupted in applause when the final vote count was announced on Thursday.
The overwhelming majority of MPs voted in favour of the bill, with only four MPs voting no.
A rainbow flag was unfurled in the chamber as MPs cheered, clapped and hugged.
Shortly after the bill was passed, the packed public gallery started singing the well-known Australian song 'I Am Australian'.
Independent Bob Katter, and Liberals David Littleproud, Keith Pitt and Russell Broadbent were the only MPs who voted no.
"What a day for love, for equality, for respect. Australia has done it," a beaming Prime Minister Malcolm Turnbull said.
"So, as it is written that there is a time for everything, and a season for every activity under the heavens, it is now time to heal," Opposition Leader Bill Shorten said.
"A time to build, a time to love, a time to love, and is now at last a time for marriage equality."
After the bill was passed, Mr Turnbull posted on Twitter: "It's time for more marriages. More commitment. More love. More respect. Marriage equality has passed."
The prime minister said same-sex couples would be able to start getting married from early January.
Meanwhile Mr Shorten simply wrote: "#MarriageEquality is a reality."
As he celebrated with other politicians and celebrities who had hoped this day would come, the Opposition Leader said: "I'm humbled by the event. This isn't about me or any of the other 150 members of parliament.
"It's about Australia and Australians. It's about LGBTIQ Australians and their partners and their families. And we have said today you're equal, we love you, you're welcome. As has been said, love wins today."
Australian Marriage Equality's Alex Greenwich said: "We came, we saw and love finally conquered. Marriage equality is finally the law of the land and we are so proud of Australia."
Liberal MP Tim Wilson, who proposed to his partner during the debate this week on same-sex marriage, said he was proud to be an Australian.
"Today, this is a strong message to every kid that is questioning their sexual orientation or gender identity, that you do not need to be afraid, that when you look to the nation's Parliament, to our sporting heroes, and to the values that underpin this country, that you can be what you see, you see a country that is forward-looking, modern and embracing the idea that everybody has a place at our nation's table," he said.
Dean Smith, the senator who introduced the bill, said "Australians won twice'".
"They won twice on the 15th of November and they have won twice in the House of Representatives and with the outcome of legislation today," Senator Smith said.
"This is a great win for Australian values. The survey said a lot about people's attitudes to same-sex marriage, it said a lot about their attitudes about Australian values and how they should be applied in a contemporary way.
"I am proud to be a parliamentarian, I have always wanted to be a parliamentarian. Even when I was that nerdy kid at school."
Earlier in the debate, Mr Katter, who opposed same-sex marriage, told parliament: "Gay means beautiful, light, attractive, ethereal ... they took the word gay off us and now they are taking the word marriage off us."
While Mr Abbott urged MPs and the public gallery to support further debate on amendments.
"There are many members who would be only too happy to open the bar for you and then we could all come back and do this, but do it in the right way," he said previously.
The bill cleared both houses after passing the Senate last week and now only requires approval from the Governor General, a formality that will likely happen on Friday.
Thousands of same-sex couples living in Australia who were married overseas will instantly have their unions recognised under the law.
But same-sex weddings will not happen in Australia until January 2018 because same-sex couples will still need to lodge a Notice of Intended Marriage, which must be completed a month before the wedding.
The legal change brings Australia into line with the majority of the English-speaking world, with same-sex marriage already legal in 25 countries including Canada, New Zealand, the United States and the UK (excluding Northern Ireland).
It follows years of campaigning from the Australian LGBTIQ community and dozens of failed attempts to change the law.
The bill to legalise same-sex marriage, known as the Smith bill, passed both houses without amendments despite attempts from conservative MPs and senators to add additional religious protections.
Proposed amendments by Coalition MPs including former prime minister Tony Abbott and Treasurer Scott Morrison were voted down. Changes suggested by the Greens were also defeated.
Liberal MP Michael Sukkar's amendment to keep two definitions of marriage – one for same-sex couples and one for heterosexual couples – was also roundly defeated, with many of Mr Sukkar’s Coalition colleagues voting against his motion.
While the Smith bill allows churches and religious celebrants to refuse to marry same-sex couples, some conservatives wanted the right of refusal extended to civil celebrants with a “conscientious objection”.
Any amendments would have delayed the passage of the bill until at least next week as the changes would have been sent back to the Senate.
Last month, the results of the government's voluntary postal survey were announced by the Australian Bureau of Statistics.
The Australian people voted in favour of change by 61.6 per cent, triggering Prime Minister Malcolm Turnbull's promise to change the Marriage Act by Christmas.
Despite some early criticisms that the use of the postal system would make the survey inaccessible, an overwhelming 79.5 per cent of Australian voters participated in what the ABS's chief statistician called an "outstanding" turnout.
Timeline of same-sex marriage laws in Australia
- 1961: Australia introduces its first Marriage Act, which does not include a formal definition of marriage
- 2004: Marriage Act is amended to define marriage as a union of a man and a woman to the exclusion of all others, and bans the recognition of overseas same-sex unions
- 2004-15: About 20 attempts are made to introduce laws to legalise same-sex marriage to no avail
- 2015: Coalition government commits to a national plebiscite on same-sex marriage
- 2016: Senate rejects government's plebiscite plan
- August 2017: Senate knocks backs plebiscite proposal again. Coalition government pursues a national voluntary postal survey instead, with ballot papers sent out the following month
- November 2017: 61.6 per cent of eligible Australians vote in favour of changing the law to allow same-sex couples to marry
- December 2017: Same-sex couples will be allowed to marry in Australia after new laws clear parliament.
- with additional reporting from Louise Cheer