Scott Morrison has been chosen by the Liberal party room as Australia's 30th prime minister.
Mr Morrison defeated Peter Dutton 45 votes to 40 in the secret ballot. Leadership candidate Julie Bishop was knocked out in the first round.
The decision capped off a week of turmoil in Canberra that began after Mr Dutton declared his intention to force Malcolm Turnbull from the prime ministership, saying the party needed to make a change if it was to win the forthcoming federal election, due before May 18 next year.
Energy and Environment Minister Josh Frydenberg has been elected deputy Liberal leader. Mr Frydenberg will take over from Ms Bishop who had served as deputy Liberal leader under Mr Turnbull and Tony Abbott.
Mr Turnbull, who became prime minister in 2015 following a spill against Mr Abbott, stood aside on Friday after receiving a petition from a majority of Liberal MPs demanding a ballot to select a new leader. He confirmed he will resign from Parliament "not before too long", forcing a byelection in his seat of Wentworth.
At a press conference on Friday afternoon, Mr Turnbull said there had been "a determined insurgency from a number of people both in the party room and backed by voices, powerful voices, in the media, really to bring - no, not bring down the government certainly, bring down my prime ministership".
"It was extraordinary. It was described as madness by many, and I think it's difficult to describe it in any other way," Mr Turnbull said.
"The critical thing is, with politics, it's not about the politicians. That's why this week has been so dispiriting, because it just appears to be, you know, vengeance, personal ambition. You know, factional feuding, however you describe it.
"It hasn't had anything to do with 25 million Australians, and the Australians we should be focused on above all else are these little ones," Mr Turnbull said, gesturing towards two of his grandchildren, Jack and Alice, who joined him at the end of his press conference.
Australia has now changed its prime minister six times since the 2007 election.
Mr Frydenberg won the deputy's position with 46 votes in a three-way contest between himself, Greg Hunt and Steven Ciobo. Mr Ciobo received 20 votes, Mr Hunt received 16 votes and there were three abstentions.
After leaving the party room meeting, Mr Dutton offered his congratulations to Mr Morrison and thanked Mr Turnbull and Ms Bishop for their service. He said his objective was to "provide loyalty" and "make sure we win the election".
Mr Abbott, who backed Mr Dutton in his challenge for the leadership, said, "We have lost the prime minister but there is still a government to save. That's what all of us will do our best to do now, to save the government.
"As we have been reminding ourselves, we are the custodians of great cultural traditions, the liberal tradition of smaller government, greater freedom, lower taxes, the conservative, traditional support for families, small business and values and institutions that have stood the rich test of time.
"But above all we are patriots, we want to make [sure] the country is strong and as good as it possibly can be, based on the wonderful achievements we already have to our name," Mr Abbott said.
Mr Morrison did not comment as he left the meeting. Ms Bishop, who left with Mr Turnbull, did not stop to speak to the media.
Mathias Cormann, who switched his support to Mr Dutton on Thursday, tweeted after the meeting: "My sincere congratulations to Scott Morrison on his election as Leader of the Liberal Party. We must now all unite and move forward together working hard for the Australian people."
Liberal MP Melissa Price said the look on Mr Turnbull's face was "horrifying" when the result of the motion to spill the leadership was read out.
"He couldn't believe how close it was. We had gone through all of that this week and he hadn't progressed," Ms Price told ABC television after the meeting.
"It's just my opinion but I have never felt it was about policy, I always thought it was about personality."
Mr Morrison is expected to make the short drive on Friday afternoon from Parliament House to Government House in Yarralumla where he will be sworn in as prime minister by the Governor-General, Sir Peter Cosgrove.
Stephanie Peatling is a senior writer for The Sydney Morning Herald and The Age, based at Parliament House
Eryk Bagshaw is an economics reporter for the Sydney Morning Herald and The Age, based in Parliament House
Dana is a federal politics reporter, covering health and industrial relations. Previously, she was a reporter for The Australian.