Australian prime minister Scott Morrison has told jubilant supporters "I have always believed in miracles", after securing a shock election victory.
Speaking in Sydney, he said he by saying he had never given up hope of staying in power.
"How good is Australia?" he asked cheering supporters.
Opinion polls had been predicted a resounding defeat for Mr Morrison but opposition leader Bill Shorten conceded defeat late on Saturday.
Vote counting will continue on Sunday, but poll forecasts give 74 seats to Mr Morrison’s coalition, with 65 to Labor and 12 undecided.
Mr Shorten made the announcement to supporters of his Labor party in Melbourne.
He said: "It is obvious that Labor will not be able to form the next government and so, in the national interest, a short while ago, I called Scott Morrison to congratulate him."
The result comes after early exit polls indicated the Labor Party could win 82 seats in the 151-seat House of Representatives - which would see them earn a majority government.
Opinion polls had suggested the conservative Liberal Party-led coalition will lose its bid for a third three-year term and Mr Morrison would have had one of the shortest tenures as prime minister in the 118-year history of the Australian federation.
Online bookmaker Sportsbet had even paid out $1.3 million AUD (£701,520) to bettors who backed Labor two days before the election. Sportsbet said 70% of wagers had been placed on Labor at odds of $1.16.
Meanwhile, one voter had placed a $1m AUD on Labor to win days before the election.
Tony Abbott, who became the first of the three conservative prime ministers in the 2013 election, conceded defeat in the Sydney seat he has held since 1994.
"The good news is that there is every chance that the Liberal-National coalition has won this election," Abbott said.
Polling suggests climate change was a major issue in the Sydney seat for voters, who elected an independent candidate, Zali Steggall.
Senior Labor lawmaker Chris Bowen said his party may have suffered from what he conceded was an unusual strategy of pushing a detailed policy agenda through the election campaign.
"This is very close. ... There are seats which we haven't won which I was hoping to," Bowen said.
Mr Morrison is the conservatives’ third prime minister since they were first elected in 2013. He replaced Malcolm Turnbull in a leadership ballot of government colleagues in August.
Mr Morrison began the day campaigning in the island state of Tasmania in seats he hopes his party will win from the centre-left Labor Party. He then flew 560 miles home to Sydney to campaign and vote.
Mr Shorten said he was confident Labor would win, but Mr Morrison would not be drawn on a prediction.
“Tonight the votes will be counted up and we’ll see what the outcome is. I make no assumptions about tonight,” Mr Morrison said after casting his vote.
Outside the polling booth, he was approached by a demonstrator protesting over the proposed Adani coal mine that the government recently approved, but security intercepted her before she could reach the PM.
Mr Shorten contained his campaigning to polling centres in his home city of Melbourne, where he voted on Saturday morning.
He said he expected Labor would start governing from Sunday, and his top priorities would be to increase wages for low-paid workers, hike pay rates for working Sundays and reduce Australia’s greenhouse gas emissions.
“The world will know that if Labor gets elected, Australia’s back in the fight against climate change,” he said.
He has been campaigning hard on more ambitious targets to reduce Australia’s greenhouse gas emissions.
Australia is the world’s largest exporter of coal and liquefied natural gas. It is also one of the world’s worst carbon gas polluters per capita because of a heavy reliance on coal-fired electricity.
As the driest continent after Antarctica, it is also particularly vulnerable to the impacts of climate change, such as wildfires and destructive storms.
The government has committed Australia to reduce its emissions by 26%-28% below 2005 levels by 2030. Labor has promised a 45% reduction.
Mr Shorten, a 52-year-old former union leader, has also promised a range of reforms, including the government paying all of patients’ costs for cancer treatment and a reduction of tax breaks for landlords.
Mr Morrison, a 51-year-old former tourism marketer, said he had closed Labor’s lead in opinion polls during the five-week campaign and predicted a close result.
He promised lower taxes and better economic management than Labor.
An opinion poll published in The Australian newspaper on Saturday put Labor ahead of the conservatives 51.5% to 48.5.
The Newspoll-brand survey was based on a nationwide canvass of 3,038 voters from Monday to Friday. It has a 1.8 percentage point margin of error.