Australian Prime Minister Malcolm Turnbull greets supporters as he leaves a polling station after casting his vote in Sydney. Photo / AP
How did the main political leaders fare and what were the issues that counted in the Australian election?
Thoughts in both parties are now turning to leadership. Labor's rules mean its top job is automatically spilled if it doesn't form government.
THE COALITION
Liberal senator Scott Ryan said today there had been no complaints about Prime Minister Malcolm Turnbull's consultation, deliberation and process.
He said the Coalition offered the only prospect for a majority government. "It is highly likely that we will be able to eke out a majority," he told ABC radio. "If not a majority then it would be definitely the largest party or coalition in government."
It wasn't until 12.30am NZT that things picked up at the Liberal party's official election night event - and that was only when John Howard arrived.
In a break from the time-checking and milling about there were cheers and applause for the former Prime Minister.
The small group stood in relative silence when Bill Shorten was beamed on the big screen inside the room. The Labor leader's remarks on Medicare and the trade union movement elicited cries of "shame".
But the man of the hour did liven them up, despite the hour. Striding out of a lift alongside wife Lucy, Turnbull entered the ballroom to a chorus of "Malcolm" chants.
With sweat on his brow and a hoarse voice, he admitted the count was close. "I can report that based on the advice I have from the party officials, we can have every confidence that we will for a Coalition majority government in the next parliament," he said.
"We will have to wait a few days," he added, noting when that counting would resume again on Tuesday.
Turnbull slammed Labor's "extraordinary act of dishonesty" over Medicare, drawing shouts of "grubs" from the crowd.
With the make up of the new Senate still to emerge, he defended his decision to call a double-dissolution election. "We need to restore the rule of law in the construction industry," he said, as Howard and others applauded.
He saluted his wife and thanked his family, noting the challenging nature of politics. It still remains to be fully seen what challenges Turnbull - the parliament and Australian politics - will face in the coming days.
He's taken them within a whisker of government, but Sky News is reporting Labor Leader Bill Shorten could face a leadership challenge from Anthony Albanese.
Sky says unnamed sources from both the left and right of the party are encouraging Albanese to stand, as under Labor rules the leadership has to be contested if an election is lost.
But former NSW Labor Premier and now Sky commentator Kristina Keneally thought it was absurd, saying "for goodness sake, (Shorten) became a hero last night".
Frontbencher Kim Carr said Shorten had grown in his role as leader, in contrast with Turnbull "diminishing".
Carr told ABC radio: "What we've got is an extraordinary result from a man of amazing courage who's demonstrated how important it is to stand up for values that people respond to".
NSW right powerbroker Sam Dastiyari told Sky the speculation was "ridiculous" and he had no idea where the story was coming from. The Labor frontbencher said Shorten would "certainly" continue to be Labor leader. "We're just not sure whether we will be in government or not," he told the ABC.
Shorten's campaign efforts appeared to have denied the Turnbull government a clear mandate.
Big seat gains for Labor in NSW, Tasmania and Queensland created a mood of elation at the Opposition Leader's election night bash in Melbourne.
Shorten arrived to rapturous applause at the Moonee Valley Racing Club just after 1.30am NZT with wife Chloe and children Georgette, Rupert and Clementine.
Earlier Labor supporters and trade unionists hit the bar for celebratory champagnes and beers as encouraging results were posted from around the country. Every time a seat was declared for Labor a collective roar went up in the room, especially for incoming MPs who had caused upsets in marginal Liberal seats.
Shorten said one thing was for sure: "The Labor Party is back".
He added: "Three years after coming to power in a landslide, they have lost their mandate," he said of the Government.
Shorten reflected on Labor's dark days as a divided party lost in the wilderness, eluding to the mayhem of the Kevin Rudd and Julia Gillard eras.
Labor was now re-energised, he said. "We have seen cohesion, a unity of purpose, and a focus on policies," he said. The Australian people had rejected the coalition's economic programme, he said. "Whatever happens next week, Mr Turnbull will never be able to claim that the people of Australia have adopted his ideological agenda. He will never again be able to promise the stability which he has completely failed to deliver tonight."
THE ISSUES
It's being described by the Prime Minister as one of the biggest lies ever peddled in Australia - one that almost won Labor government.
Turnbull insists he can form majority government despite Labor's unrelenting Medicare scare campaign. But he concedes it's done some damage.
Turnbull told the party faithful the Coalition had faced some of the "most systematic, well-funded lies ever peddled in Australia" with Labor and the union movement spending millions of dollars frightening vulnerable Australians.
Thousands of Australians received text messages on election day purporting to be from Medicare, warning of Turnbull's plans to privatise the system.
"Time is running out to Save Medicare," it said.
Turnbull said police would "no doubt" investigate the incident. He accused Labor of boasting about how skillfully it had lied on Medicare, describing it as a "shameful episode in Australian political history".
He said: "This is the scale of the challenge we faced. And regrettably more than a few people were misled."
Attorney-General George Brandis said the Liberal Party had referred the matter to police.
Health Minister Sussan Ley has called on Shorten to rule out that Labor or affiliated unions were behind the "desperate and deceitful" messages.
A Sky News Exit Poll showed health and Medicare was the most important issue for 72 per cent of voters.
Liberal Party Victorian president Michael Kroger said he personally complained to Medicare about fake cards that carried the agency's trademark were being distributed by the ACTU as part of its scare campaign. But no one got back to him.
"If you did this to any other organisation they would've taken an injunction against you," he told Sky News. "They should have stopped this."
Brandis has dismissed suggestions the Coalition did not run hard enough on economic management issues in its campaign.
The Attorney-General says the discussion for the first six weeks of the long campaign was all about Turnbull's economic plan for jobs and growth.
"The Labor Party wasn't getting anywhere, so two weeks out ... they decided to throw the kitchen sink at the Medicare scare campaign ... it was a disgraceful and fraudulent campaign," Brandis told Sky News.