The Morrison government faces a hung parliament and a delicate negotiation with crossbenchers to retain its control of parliament after independent Kerryn Phelps was elected in a landslide in Wentworth.

The by-election in Malcolm Turnbull’s former seat saw voters deserting the Liberal party in droves, with a swing of more than 20 per cent against the government – the biggest in Australian history for a by-election.

Independent candidate Kerryn Phelps will be sworn in as the next member for Wentworth, ending decades of Liberal dominance in the affluent Sydney harbourside seat.

“It was said if we won the seat of Wentworth, it would make history,” Dr Phelps told a crowd of cheering supporters.

“My friends, we have made history today.”

The Liberal primary vote evaporated as early ballot boxes were returned, with most news outlets calling the result just over an hour after the polls closed at 6pm.

Dr Kerryn Phelps celebrates after winning the seat of Wentworth at the North Bondi Surf Lifesaving Club.

Dr Kerryn Phelps celebrates after winning the seat of Wentworth at the North Bondi Surf Lifesaving Club.

Getty Images

With around half the vote counted, official results from the Electoral Commission showed Liberal candidate Dave Sharma had attracted just 39 per cent of first-preference votes.

Dr Phelps received less on 33 per cent but surged well clear of her rival with the help of preferences from Labor, the Greens and the other independents.

Mr Sharma conceded defeat in a speech to the Liberal faithful, congratulating Dr Phelps on her win.

The former ambassador to Israel said he remained committed to the “ethos” of public service, and would “continue to find ways” to serve the community in “ways that suit me”.

Mr Sharma did not explicitly say he would contest Liberal pre-selection again at the full general election, due within six months.

Prime minister Scott Morrison also spoke, in an upbeat speech that promised supporters he would fight “all the way to the election”.

The Liberal party’s spirit was “indomitable”, he said.

The disastrous result does not spell the end of the Morrison government, but it does make the Coalition’s control over the House significantly more precarious.

The PM told supporters he he would fight "all the way to the election”.

The PM told supporters he he would fight “all the way to the election”.

AAP

It will now rely on crossbench independents to guarantee confidence in the government and supply the flow of money.

Dr Phelps will join an expanded crossbench, sitting alongside Bob Katter, Rebekha Sharkie, Cathy McGowan and the Greens’ Adam Bandt.

Ms Sharkie and Mr Wilkie have already signalled a move to bring asylum seeker children and their families from Nauru to Australia for medical attention, and are confident they will have the numbers with the support of their new colleague.

Meanwhile, Queensland crossbencher Bob Katter has made it clear he will cause “mayhem” for the Morrison government unless it heeds his demands for a longer, tougher Royal Commission into the banks and investment in dams. 

Liberal candidate Dave Sharma arrives at the Liberal Party election function in Double Bay.

Liberal candidate Dave Sharma arrives at the Liberal Party election function in Double Bay.

AAP