Burkina Faso's army chief Navere Honore Traore said he was taking power on Friday as head of state after President Blaise Compaore announced his resignation.
"In line with constitutional measures, and given the power vacuum ... I will assume as of today my responsibilities as head of state," said Traore in a statement.
This followed four days of mass protests over a bid to extend Mr Compaoré’s 27-year rule.
In a statement issued by the presidency and read on local television, Compaoré announced that he was stepping down.
He declared a "power vacuum" and called for "free and transparent" elections within 90 days.
Earlier, the opposition had urged followers "to keep up the pressure by occupying public spaces".
"A prerequisite for any discussion on any political transition is the unconditional departure of Mr Blaise Compaoré, pure and simple," said opposition chief Zephirin Diabre.
ARAB SPRING PARALLEL
Tens of thousands of protesters demanded the "immediate" resignation of Compaoré, chanting "Blaise, get out!" outside military headquarters in the capital.
Two opposition figures said around 30 people were killed and more than 100 injured in violence on Thursday, while AFP could only confirm four deaths and six serious injuries, based partly on reports from the capital's main hospital.
Army official Colonel Boureima Farta on Friday told tens of thousands of protesters that Compaoré had been ousted.
This came shortly before the statement from the presidency announcing Compaoré’s resignation.
His resignation came as tens of thousands of protesters demanded that he quit immediately after unrest that saw mass protests and the storming of parliament and other public buildings.
Some have drawn a parallel between the protests and the Arab Spring revolution, and the situation is being closely watched across Africa, where at least four heads of state are preparing or considering similar changes to stay in power.
"In order to preserve the democratic gains, as well as social peace... I declare a power vacuum to allow the establishment of a transition leading to free and fair elections within a maximum of 90 days," Compaore said in a statement read on local television.
FRANCE PLEDGES SUPPORT
News of Compaoré’s departure had initially come from an army officer hoisted on the shoulders of comrades in front of the army headquarters in Ouagadougou, the capital of the landlocked West African nation.
"Compaoré is no longer in power," Colonel Boureima Farta told a crowd of thousands, who erupted into cheers.
Compaoré had initially rejected calls to resign, prompting the demonstrators to gather outside the military base, chanting: "Blaise, get out!"
France's President Francois Hollande vowed that Paris would "contribute to calming" the situation in its former colony as the news emerged, adding that he was sure Compaoré would "take the right decision in the coming hours to achieve the calm necessary."
The EU called for the people of Burkina Faso to have the final say in who rules their country.
"The European Union believes that it is up to the people of Burkina Faso to decide their own future. Any solution must be the result of a broad consensus and respect the constitution," a spokesman for the bloc's diplomatic service said.
The protests on Thursday forced Compaoré to withdraw plans to try to change the constitution to extend his rule, although he had then vowed to stay in power for another year under a transitional government.
WATCHED ACROSS AFRICA
The protests started as lawmakers prepared to vote on legislation that would have allowed 63-year-old Compaoré to contest elections in November 2015.
They have plunged Burkina Faso into its worst crisis since a wave of mutinies shook the country in 2011.
Compaoré was only 36 when he seized power in a 1987 coup in which his former friend and one of Africa's most loved leaders, Thomas Sankara, was ousted and assassinated.
He has remained in power since, re-elected president four times since 1991 — to two seven-year and two five-year terms.
Compaoré is one of a number of sub-Saharan African leaders who have stayed in power for decades.
His bid to cling to power has angered many, particularly young people in a country where 60 per cent of the population of almost 17 million is under 25.
Many have spent their entire lives under the leadership of one man and are disillusioned by the establishment running the poor former French colony which is stagnating at 183rd out of 186 countries on the UN human development index.
Some Burkinabe protesters have likened the protest to the Arab uprisings that began in 2010.
"October 30 is Burkina Faso's black spring, like the Arab spring," Emile Pargui Pare, an official from opposition party the Movement of People for Progress, told AFP earlier this week.
Burkina Faso's army chief had on Thursday made his own announcement that the government had been dissolved.
The army imposed a dusk-to-dawn curfew and pledged to restore constitutional order within 12 months, in a statement signed by Nabere Honore Traore on Thursday.
Leading opposition politician Benewende Sankara described the army's move as a "coup".
Many of the tens of thousands massed on the streets of the capital called for retired general and former defence minister Kouame Lougue to take control, shouting: "Lougue in power!"
There were reports that Traore had met Lougue to discuss the crisis.
Envoys from the UN, the African Union and the Economic Community of West African States (Ecowas) were expected Friday in Burkina.
Known in colonial times as Upper Volta, the landlocked country became independent from France in 1960 and its name was changed to Burkina Faso ("the land of upright men") in 1984.