Australia's Turnbull government retained its one-seat majority after former tennis star John Alexander won back the Sydney seat of Bennelong.

But Alexander shocked with a bizarre joke during his victory speech, appearing to suggest he has "more pride" than the disabled.

With Turnbull at his side, Alexander told an anecdote about his former career as a professional tennis player - a career that came to an end due to a back injury.

"I was eligible for the disabled sticker on my car! The doctor at the time said, 'You have eligibility for a disabled sticker.' I said, 'I still have some pride.' That was before I entered politics!"

Advertisement

The Daily Mail reported the crowd had roared with cheers when he mentioned he was once 14th in the world - but the sticker comments drew a smattering of awkward laughter.

Turnbull appeared to chuckle only slightly at Alexander's gaffe, the Mail said.

Sky News presenters covering the outcome of the election suggested Alexander would surely apologise before too long - and his comments were quick to draw condemnation.

Alexander's victory against Labor's star candidate, former NSW premier Kristina Keneally, will come as a relief to Prime Minister Malcolm Turnbull. The Liberal Party will retain the seat with a margin of 9.7 per cent, despite a swing against Alexander of around 5 per cent.

"There is no sign of a swing larger than that or significantly larger than that which could endanger the Liberal Party holding the seat and John Alexander will be re-elected," ABC election analyst Antony Green said.

The by-election in the northwestern suburban electorate in Sydney was called after Alexander resigned from parliament after he suspected he was a dual citizen.

Saturday's by-election became a tight contest after Labor took up the fight for the seat by selecting former NSW premier Keneally, and throwing big names and resources into its campaign.

But the by-election has been less about the candidates, and more about the future of the Turnbull government and Malcolm Turnbull's leadership.

A Liberal loss would have left the government with 75 seats, meaning the coalition would no longer have had a majority in the House of Representatives.

Both Prime Minister Malcolm Turnbull and Opposition Leader Bill Shorten were at polling booths in the Sydney electorate.