Rebels and the Ivory Coast government have agreed to end hostilities after four days of talks in South Africa.
Mbeki has been determined to end the stalemate
Tension has risen in recent weeks, prompting fears of renewed war in the world's biggest cocoa producer.
A ceasefire agreed in France two years ago failed to end conflict in the country which remains divided in two.
South African host, President Thabo Mbeki, welcomed the decision and praised all sides for being involved in the talks over a long period of time.
Some of the key points are:
- a recommitment that the war is over;
- a commitment to disarming and disbanding militias as soon as possible;
- rebels agree to start disarming after a meeting with the army in just over a week's time;
- Mr Mbeki to consult with the United Nations secretary general and African Union before ruling on eligibility to fight the presidency - an issue which has dogged the process for some time;
- the holding of elections later in 2005
"The Ivorian parties that are signatories to the Pretoria agreement hereby solemnly declare the immediate and final cessation of all hostilities and the end of the war throughout the national territory," they said in a joint statement.
The gathering in Pretoria is the first time all the major Ivorian politicians have been together since July last year.
Mr Mbeki, who is mediating on behalf of the African Union, had announced that the leaders, including President Laurent Gbagbo, former head of state Henri Konan Bedie, opposition leader Alassane Ouattara and rebel chief Guillaume Soro would not leave until they found a solution.
Since the rebels, now called the New Forces, seized the north of Ivory Coast in an uprising in September 2002, peace has proved elusive.
A peace deal was signed in January 2003, but last November President Gbagbo's forces attacked the rebel north.
Tension has been high since then, with reports that both sides are preparing for renewed conflict.
UN peacekeepers patrolling Ivory Coast's buffer zone say they have seen armed men in western government-held towns and a Human Rights Watch report has accused the government of recruiting fighters, including children, from neighbouring Liberia.
Earlier this week, the UN extended by one month the mandate of 6,000 peacekeepers, backed by 4,000 French troops.
In the past the rebels have refused to disarm until a series of reforms are undertaken to allow the main opposition leader to stand as a candidate.
Mr Ouattara, a former prime minister, is banned because the government says his parents came from Burkina Faso.