Tory leadership: Boris Johnson and Jeremy Hunt are final two
Jeremy Hunt has promised Boris Johnson "the fight of his life" as the two compete to become the next Conservative leader and PM.
Mr Johnson said he was "honoured" to get the backing of 160 MPs in the final ballot of the party's MPs - more than half of the total.
Mr Hunt got 77 votes - two more votes than the next candidate Michael Gove.
Mr Johnson and Mr Hunt now face a vote involving up to 160,000 Tory members, with a result due by late July.
All 313 Conservative MPs took part in the final ballot in the House of Commons, with one paper spoilt.
Mr Johnson's victory in the latest round of the contest had been widely expected, but Environment Secretary Mr Gove and Foreign Secretary Mr Hunt had been engaged for several days in a fight for second place.
In the penultimate MPs' ballot, earlier on Thursday, Mr Gove overtook his rival, only to see his lead reversed in the final vote.
Before the final vote, a source close to Mr Hunt warned against reigniting the "personal psychodrama" between Mr Gove and Mr Johnson - who spearheaded the Vote Leave campaign together in 2016, but fell out after Mr Gove abandoned Mr Johnson's previous leadership bid to launch his own.
- Live: Final MPs' ballot reaction
- Iain Watson: Stage set for Johnson v Hunt
- Compare the candidates
- Sajid Javid knocked out of Tory contest
Following the result of the final ballot, Mr Johnson tweeted that he was "deeply honoured" by his level of support.
Meanwhile, Mr Hunt, acknowledged Mr Johnson as frontrunner to become party leader and prime minister, tweeting that he was the "underdog" but in politics "surprises happen".
He went on to praise Mr Gove as one of the "brightest stars in the Conservative team" and pledged to "give Boris the fight of his life."
Mr Gove congratulated his rivals and said he was "naturally disappointed but so proud of the campaign we ran".
His campaign manager, Mel Stride, said he believed that Mr Gove's admission that he had taken cocaine during the 1990s had damaged his bid, adding: "It stalled us and meant momentum was lost at that time."
There's no doubt that Mr Johnson is, at this stage (and there's a long way to go), widely expected to end up in Number 10.
But this result is an enormous relief to his camp, for the simple reason that they think Mr Hunt is easier to beat.
Forget any differences in style between the two challengers and their comparative talents - Jeremy Hunt voted Remain in the EU referendum.
And for many Tory members it is a priority for the next leader to have been committed to that cause, rather than a recent convert, however zealous.
Mr Johnson and Mr Hunt will now take part in hustings in front of Conservative Party members around the country, before the votes are counted, with the final result to be announced during the week of 22 July.
They will also take part in a head-to-head debate on ITV on 9 July, following previous leadership debates hosted by Channel 4 and the BBC.
Mr Hunt has been in the cabinet since 2010. Before he became Foreign Secretary, he was the UK's longest-serving Health Secretary. Former Foreign Secretary Mr Johnson, who quit the cabinet last year over Theresa May's Brexit strategy is one of the UK's most recognisable politicians and was Mayor of London from 2008 to 2016.
The Conservatives said there had been 20,000 applications for places at the 16 leadership hustings around the UK. Party chairman Brandon Lewis congratulated the final two contenders.
He said: "We are conscious that the Conservatives are not just selecting a new leader but also the next prime minister, and we take that responsibility extremely seriously at such an important time for our nation."
Labour's national campaigns co-ordinator Andrew Gwynne said: "What a choice: the man who broke the NHS or the man who wants to sell it to Donald Trump.
"A handful of unrepresentative Conservative members should not be choosing our next prime minister. People should decide through a general election."
The ballot of MPs earlier on Thursday saw Home Secretary Sajid Javid eliminated from the contest.