Theresa May and Andrea Leadsom will battle it out to become the next leader of the Conservative Party after Michael Gove was eliminated from the contest.
After the second MPs' ballot, Home Secretary Mrs May finished with 199 votes, Energy Minister Mrs Leadsom 84 and Mr Gove, the justice secretary, 46.
Conservative members will now decide the winning candidate, with the result due on 9 September.
The winner will become the UK's second female prime minister.
Mr Cameron resigned after finishing on the losing side in the UK's EU referendum, in which there was a vote for the UK to leave.
The results were announced at Westminster by Conservative MP Graham Brady, the chairman of the backbench 1922 Committee.
There had originally been five contenders to succeed Mr Cameron, with MPs voting in two rounds to get that number down to two.
The contest now moves to its final stage with the Conservative Party's 150,000-strong membership deciding between Mrs May, a Remain campaigner with a long track record in government, and Mrs Leadsom, a leading light of the Brexit campaign who has stressed her City and business background.
Speaking after the results were announced, Mrs May said she had secured support from all wings of the Conservative Party and pledged to bring the Tories together.