KABUL—Afghanistan's rival presidential candidates agreed to a full audit of the June 14 runoff election, breaking a political stalemate over the vote's outcome after two days of intense diplomacy by U.S. Secretary of State John Kerry.

"The audit will be carried out in Kabul, and it will begin within 24 hours," Mr. Kerry said Saturday, standing next to the two candidates, former Finance Minister Ashraf Ghani and former...