A powerful swing to the Coalition in key parts of a divided nation has put Prime Minister Scott Morrison within sight of holding on to power after conflicting results in the north and south of the country produced a cliffhanger federal election.
Labor leader Bill Shorten had been favoured in exit polls and made significant gains in some seats in NSW and Victoria, while independent candidate Zali Steggall defeated former prime minister Tony Abbott in Warringah.
Labor held both its lower house seats in Canberra, and picked up the new seat of Bean as well.
But his bid to become Australia's 31st Prime Minister - through a platform of tax, wages and climate policy reform - was in deep trouble with his party suffering damaging defeats in key electorates the party needed to claim power.
Scott Morrison's presidential-style campaign focussing on income tax cuts and risks to the economy under Labor led the Coalition to significant gains in Queensland and Tasmania and has given him a realistic chance of a shock outright victory or minority government.
With so many gains for the Coalition and so few for Labor, Mr Shorten's hopes of becoming Prime Minister receded as election night went on.
The Coalition, which has trailed Labor in the polls throughout its turbulent time in government, went in to the campaign with 74 seats and added to that tally across Queensland, where it defeated Labor in Longman and Herbert. The Coalition also wrested the Tasmanian seat of Braddon from Labor and appeared likely to claim the neighbouring electorate of Bass as well.
The Coalition and Labor teams were anxiously waiting on results from Western Australia to be sure of the outcome. The Coalition's gains left Labor clutching to the hope of negotiating with crossbench MPs to hold government in a hung Parliament.
With the electorate enduring more than a decade of unprecedented parliamentary bloodletting - Australia has had seven Prime Ministers in 11 years - many neutral observers were hoping for a period of political stability.
However, the result shows the nation is divided along geographic and ideological lines with Mr Abbott declaring a political "realignment" with Labor making gains in progressive wealthy seats and the Coalition doing better in working class areas. A group of key independents could still hold the key to power.
Mr Abbott said the Coalition would be able to retain government even though he conceded he would lose his seat of Warringah, a safe Liberal electorate for years that came under attack from independent candidate Zali Steggall and her campaign for more action on climate change.
"The good news is that there is every chance the Liberal National Coalition has won this election," Mr Abbott said.
"This is a really extraordinary result, it is a stupendous result, it is a great result for Scott Morrison and the rest of the Liberal team, and Scott Morrison will quite rightly enter the Liberal pantheon forever."
In western Sydney, the electorate of Lindsay fell to the Liberals while the neighbouring electorate of Macquarie appeared to be shifting in the same way. In eastern Sydney, the Liberal Party was confident of regaining the blue-ribbon seat of Wentworth with Liberal candidate Dave Sharma ahead of independent MP Kerryn Phelps, who gained the seat at a byelection last year.
The outcomes give the Coalition a narrow majority in the House of Representatives unless it suffers the loss of other seats.
Labor gained the seat of Gilmore on the NSW South Coast and the two Victorian seats of Chisholm and Dunkley.
Early in the night, Mr Shorten appeared to be on track to become Australia's 31st prime minister after an exit poll predicted a swing to Labor, with voters naming health and climate change as key factors in their decisions.
While Labor Party members were buoyant before the early count, Mr Morrison expressed caution about his chances, saying he made "no assumptions" about holding on to power.
While the Liberal Party appeared likely to regain Wentworth, independent MPs made gains elsewhere with Victorian independent Helen Haines on track to win Indi and succeed former independent MP Cathy McGowan.
Combined with the victory for Ms Steggall, the election appears to leave Parliament with a crossbench that includes Greens MP Adam Bandt, Tasmanian independent Andrew Wilkie, Queenslander Bob Katter, South Australian Rebekha Sharkie as well as Ms Steggall and Dr Haines.
Mr Wilkie has ruled out doing any deal with a minority government while Mr Katter has backed the Coalition in the past. Others have named climate change policy as a factor in their decisions on whether to support a minority government on votes of confidence and supply.
The government's 74 seats in the House of Representatives was down from the 76 it won at the last election due to the departure of former Liberal MP Julia Banks to the crossbench and the arrival of independent MP Kerryn Phelps in Wentworth.
- SMH/The Age