Mr Compaore issued a statement saying the presidency was now vacant and urging elections within 90 days.
Military chief Gen Honore Traore said he had taken over as head of state "in line with constitutional measures".
Crowds danced and cheered in the capital, Ouagadougou, after Mr Compaore's resignation was broadcast.
On Thursday, protesters angry at his attempt to amend the constitution had set fire to parliament and government buildings.
There was a euphoric atmosphere in the Place de la Nation as the thousands of protesters heard that Blaise Compaore was no longer their president.
The demonstrators sang the national anthem. But the crowds have no intention of going home, as they are unhappy that Gen Honore Traore has been appointed as transitional head.
He is seen as too close to the ousted president - he was Blaise Compaore's aide de camp - and for these demonstrators that is not enough of a rupture with the past. They have been chanting "Lougue, Lougue, Lougue" - the name of retired Gen Kouame Lougue, a former defence minister who fell out with Mr Compaore in 2003.
"This is not a coup - this is a popular uprising," one man in the crowd said. "We rose up, we fought and we won, and now we are saying we want this man to lead. We don't want Honore, we want Kouame Lougue."
Mr Compaore had earlier vowed to remain in power until a transitional government completed its work in 2015, although he had agreed not to seek another term.
However, the opposition continued to demand that he resign - a key leader, Zephirin Diabre, urged protesters to occupy public spaces.
After the resignation, Mr Diabre told the BBC's Focus on Africa radio programme: "We are all relieved by what is happening - and this is our demand for so long so we are very happy - and we need to work on the transition to take care of our country."
Mr Compaore's statement, read on television, said: "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."
He added: "For my part, I think I have fulfilled my duty."
His whereabouts now remain unclear.
However, Reuters news agency reported that a heavily armed convoy believed to be carrying Mr Compaore was travelling towards the southern town of Po.
One protester, Sam, told the BBC: "Blaise Compaore has gone away, he's running away and we are happy. The words are not coming so easy because I'm very happy, my children are going to know another president."
An expatriate living in Ouagadougou, Joost Laane, said he had seen some looting of shops and houses.
Images showed people carrying goods from the home of Mr Compaore's younger brother, Francois.
In his statement, Gen Traore said: "In line with constitutional measures, and given the power vacuum... I will assume as of today my responsibilities as head of state."
He added: "I undertake a solemn engagement to proceed without delay with consultations with all parties in the country so as to start the process of returning to the constitutional order as soon as possible."
An army spokesman, Lt Col Isaac Zida, later told reporters the constitution had been suspended, but it was unclear whether he was speaking on behalf of Gen Traore.
The BBC's Yacouba Ouedraogo, in Ouagadougou, says there may be a split in the army, with Col Zida saying he will lead the transition, not Gen Traore.
Blaise Compaore was a young army officer when he seized power in 1987, a taciturn man who became known as Beau Blaise - good looking Blaise. The nickname did not necessarily suggest he was popular. Many blamed him for the death of his predecessor, the charismatic revolutionary Thomas Sankara, who was killed by soldiers in mysterious circumstances.
Controversy would be a perpetual feature of Beau Blaise's time in power. The president was accused of stoking rebellions around West Africa. Yet over time Mr Compaore oversaw a transformation of his image, internationally at least. This inflammatory figure became a man relied upon to put out fires around the region.
Mr Compaore won a series of elections, though the opposition always complained the odds were stacked dramatically in his favour. He largely followed the economic orthodoxy prescribed by international financial institutions. But Burkina Faso did not escape the poverty trap. It remains one of the least developed countries in the world.