Only four MPs did not back the legislation, which comes after the country voted overwhelmingly in favour of legalising same-sex marriage last month.
Onlookers in the packed public gallery cheered loudly and started waving their rainbow flags while singing “I Am Australian”.
Several politicians on the floor of the chamber joined in. One could be seen wiping away a tear.
“What a day for love, for equality, for equality, for respect. Australia has done it,” Prime Minister Malcolm Turnbull said.
“This is Australia, fair and diverse, loving and filled with respect.”