The Australian Parliament voted 146 to 4 in support of same-sex marriage.
"What a day for love, for equality, for respect! Australia has done it," Prime Minister Malcolm Turnbull told the House. "Every Australian had their say and they said it is fair, get on with it!
Supporters of same-sex marriage gathered outside Parliament House and packed the public gallery in anticipation of the legislation going through.
"It's a historic day for Australia today and I think the celebrations around the country when we finally … achieve marriage equality are going to be immense," Greens party senator Janet Rice said.
The law will likely come into effect in about a month, with the first wedding expected about a month later.
The Senate passed the same legislation last week 43 votes to 12. The only potential obstacle to the law passing was if one of the many amendments was adopted, meaning the bill would have to go back to the Senate.
The bill now needs to be ratified by Australia's Governor-General, who represents Queen Elizabeth II as head of state, to make it law. This formality would be completed in a matter of days, paving the way for the first weddings to take place early next year. That was the hope of Australian Prime Minister Malcolm Turnbull after 62% of Australians voted in favor of same-sex marriage in a legally non-binding postal survey conducted over two months earlier this year. Almost 80 percent of the population responded to the survey.
Australia joins about two dozen countries around the world, including Germany, which have legalized same-sex marriage. Austria on Tuesday also approved same-sex marriage.