"National general elections will be held towards the end of February 2015," said mediator and South African Deputy President Cyril Ramaphosa.
The exact date for the polls, originally set for 2017, will be set by King Letsie III, he added.
Just two years ago, Lesotho was hailed as a beacon of democracy in southern Africa, carrying out a peaceful handover of power, then forming one of Africa's rare coalition governments.
Today's agreement will also see parliament reconvene on October 17 after being shuttered by Prime Minister Tom Thabane in June as he looked poised to lose a no-confidence vote.
Also Read
Ramaphosa said the reconvened parliament would be limited to passing a budget and preparing the ground for elections, apparently ruling out a vote of no confidence.
Seated beside Ramaphosa during today's declaration, the 75-year-old Thabane kept his eyes cast downward almost throughout and offering no comment.
On August 30, Thabane was forced to flee his country to neighbouring South Africa, as the military attacked several police stations.
"No party of government that has to go to premature elections enjoys it. But what has been found here is a way forward, which is no mean feat."
Major questions remain about the role of the armed forces.
Lesotho Defence Forces commander Tlali Kamoli is being investigated for treason and murder for his alledged role in the coup. He refuses to step down.
Today, Ramaphosa called for the de-politicisation of the security services, and for its members to do their bit to help the tiny mountain kingdom out of crisis.
He added that police officers and military advisors from the Southern African bloc SADC would remain in the country until after the vote.