The Turnbull government has retained its one-seat majority after John Alexander won back the Sydney seat of Bennelong, despite a swing against him following a bitterly fought campaign.
Mr Alexander's victory against Labor's star candidate, former NSW premier Kristina Keneally, will come as a relief to Prime Minister Malcolm Turnbull.
A loss would have left the government with 75 seats, in the 150-seat House of Representatives, forcing it to rely on the cross bench to get its legislation through.
It would also have put Mr Turnbull's leadership under pressure.
But with nearly 80,000 votes from 37 of 39 booths counted, Mr Alexander had won 59.72 per cent of the two-candidate preferred vote compared to Ms Keneally's 45.86 per cent despite a swing against him of 5.58 per cen