Afghan presidential candidate Abdullah Abdullah has agreed to rejoin an audit of the votes, the UN said, after tense negotiations to rescue the election amid a prolonged dispute over fraud.
The country's first democratic transfer of power has been engulfed in fraud allegations, undermining international hopes that a smooth election would help vindicate the costly US-led military and civilian aid effort since 2001.
Abdullah's representatives refused to attend the recount on Sunday due to disagreements over how votes would be judged fraudulent or clean - throwing the election into further chaos.
But a deal was finalised later in the day, averting an imminent collapse of the process to choose President Hamid Karzai's successor as Nato combat troops wind down their 13-year war against the Taliban.
Abdullah's team "informed the United Nations that it will ... resume its participation in the audit process tomorrow," the UN said on Sunday.
More than eight million votes were cast on June 14, with Abdullah quickly lodging complaints that "industrial-scale" fraud had denied him victory over poll rival Ashraf Ghani.
The election was fought between Abdullah, a former anti-Taliban fighter, and Ghani, an ex-World Bank economist.
After Abdullah rejected preliminary results that named Ghani as the easy winner, US Secretary of State John Kerry flew to Kabul and persuaded the two candidates to agree to the audit to sift out fraudulent votes.