Afghanistan's feuding presidential candidates have signed a deal to work on the formation of a national unity government, as an audit attempts to decide the winner of the country's fraud-tainted election.

Abdullah Abdullah, a former foreign minister, and ex-finance minister Ashraf Ghani Ahmadzai, agreed to resolve their dispute on Friday in a deal brokered by US Secretary of State John Kerry.

Abdullah said the agreement was a "step forward in the interests of strengthening national unity ... and bringing hope to the people for the future of Afghanistan".

The two rivals have been locked in a bitter dispute over who will succeed Afghan President Hamid Karzai following June's runoff election.

The breakthrough came as Kerry opened a second day of talks aimed at preventing the fragile country from collapsing into political chaos.

The joint declaration stated the candidates would agree to a timeline for the electoral process and inauguration date for the next president by the end of August.

Afghanistan's western backers hope an audit of votes will produce a legitimate president before a NATO summit in early September.

The UN is supervising a full recount of all eight million votes cast in a June run-off vote, as agreed during Kerry's last visit to Afghanistan a month ago.

"This audit is not about winning and losing, it is about achieving a credible result that people of Afghanistan deserve," Kerry said.

The election was to mark Afghanistan's first democratic transfer of power before most foreign troops pull out at the end of 2014.

Source: Agencies