Same-sex marriage will be legal in Australia, with Parliament agreeing to change the Marriage Act and end the ban on gay and lesbian couples marrying.

Four members of the House of Representatives voted against the bill and some abstained, but an overwhelming majority voted for the bill.

Liberal senator Dean Smith's bill will now become law after a day of cheers, tears and applause in the Lower House.

People queued for access to the public gallery to witness the law being changed and by the time of the final vote, they were packed into every spot.

Sorry, this video has expired The moment Parliament said yes to same-sex marriage

Same-sex marriage supporters wearing colourful "Yes" T-shirts clapped and cheered as amendments were voted down, prompting repeated warnings they should stop their barracking.

The public gallery led a chorus of We Are Australian after the final vote, with members of the parliament joining in from the floor of the House in tears.

Sorry, this video has expired "What a day for love": Political leaders comment on passing of same-sex marriage bill

There had been little doubt that this bill would pass with sweeping support from Nationals, Liberals, Greens, the crossbench and Labor.

Opponents of same-sex marriage including Liberals Andrew Hastie, Kevin Andrews and Tony Abbott pushed for changes, but none of their amendments succeeded.

The legislation passed the Lower House three weeks after Senator Smith stood in the Senate and declared "it was not just a vote about a law but a vote about who we are as a people".

Queensland crossbencher Bob Katter, LNP MPs David Littleproud and Keith Pitt and Victorian Liberal Russell Broadbent were the four to vote against the bill.

There was no count of the votes for, because names are not taken when there are less than five people opposed to a bill.

But Thursday's result was overwhelmingly for change.

Senators supporting the bill huddled together on the side of the Lower House chamber to join the celebrations.

Veteran same-sex marriage campaigner Warren Entsch was besieged by his colleagues.

MPs Trent Zimmerman and Warren Entsch walking out of the House of Representatives arm in arm. ( ABC News: Marco Catalano )

Earlier, gay Liberal MP Trent Zimmerman noted Mr Entsch's long-standing advocacy, lauding him as an "honorary gay".

Prime Minister Malcolm Turnbull said after the vote that he was "so proud that this has occurred while I am Prime Minister while the Liberal and National parties are in Government".

"It is a great moment in our history, a great moment in our political history."

Magda Szubanski celebrates legalising same-sex marriage with her fellow Yes campaigners. ( ABC News: Marco Catalano )

How did we get here?

It has been 13 years since the Howard government changed the Marriage Act to ensure same-sex marriage could not be legal.

From that point, the Greens and Australian Democrats made repeated but unsuccessful attempts to overturn that decision, and Mr Entsch came to prominence with his passionate advocacy to allow gay marriage.

Greens MP Adam Bandt was one of many with a few tears in his eyes after the vote. ( ABC News: Matt Roberts )

Five years ago, parliament had three bills before it to try to allow same-sex marriage: one in the Senate from the Greens, another a joint bill in the Lower House from Green Adam Bandt and independent Andrew Willkie, and a third from Labor's Stephen Jones. None succeeded.

The pivotal and ultimately successful manoeuvre came quietly and carefully more than a year ago.

It was a masterclass in political technique.

The Coalition's policy for a plebiscite was blocked in the Senate, but Attorney-General George Brandis started to ease the political gridlock by producing a draft bill anyway.

The Parliament were all on their feet. ( ABC News: Matt Roberts )

That was on the basis that if a plebiscite was actually held and voters supported same-sex marriage, then a bill would be needed.

More political guile was evident in the way a Senate committee was chosen to examine that bill, with members including Senator Smith and fellow gay senator Louise Pratt, from Labor, as well as opponents of same-sex marriage like Nationals senator John Williams.

In a unanimous report, the committee laid the groundwork for the process that ended on Thursday, by finding a way through the passionately held views on both sides of the debate.

Christopher Pyne hugged fellow liberal Trent Zimmerman after the vote. ( ABC News: Matt Roberts )

It set out that ministers of religion should be exempt from conducting same-sex marriages, finding there was consensus that religious freedom should be protected.

And crucially it said marriage could be simply defined as between two people.

Thursday's vote implements that, and the House of Representatives has overturned the change made by the Howard government in 2004 to limit marriage to being between a man and a woman.