The Ivory Coast government and the rebel movement have signed an accord in a fresh attempt to revive the country's stalled peace process.
Mr Gbagbo has been opposed by northern rebels since 2002
The two sides agreed to form a new power-sharing government within five weeks and set up a joint army command.
The deal was signed in Burkina Faso by President Laurent Gbagbo and rebel leader Guillaume Soro.
Its aim is to unite Ivory Coast, which has been split since rebels seized the northern half of the country in 2002.
The accord, signed in the capital of Burkina Faso Ouagadougou, comes after a month of negotiations between the two sides.
IVORY COAST DEAL
Power-sharing cabinet within five weeks
Joint army command
North-south buffer zone removed
Timetable for disarmament, voter registration and elections
It is not yet clear who will be named prime minister of the new government, but there is strong speculation that Mr Soro has been offered the job.
The buffer zone between the two sides - known as the confidence zone - is to be removed. It is currently patrolled by 10,000 French and UN troops.
The joint army command - to be set up within two weeks - is to include both rebels and supporters of Mr Gbagbo.
The deal sets a timetable for disarmament and for a mass identification programme to give identity cards to the millions of Ivorians who do not have them.
It is estimated that elections, which have been postponed twice already, could be held in 10 months.
The BBC's James Copnall in Ouagadougou says the accord is Ivory Coast's best ever hope for lasting peace, but past failures suggest there is no guarantee the chance will be taken.
This is only the latest in a long list of deals and Ivorian politicians are famous for not respecting the accords they have signed, our correspondent says.
The executive secretary of West African grouping Ecowas, Mohamed Ibn Chambas, said Sunday's accord could succeed where others have failed because Mr Gbagbo and Mr Soro have been involved.
"What is different this time is that the two major protagonists have agreed, and have negotiated directly," Mr Chambas said.
"That gives cause for some optimism," he added.
France, the former colonial power welcomed the agreement, saying it should enable peacekeepers to begin pulling out immediately.
The rebels from the mainly Muslim north launched an attempted coup against Mr Gbagbo in September 2002, complaining of widespread discrimination.