Lieutenant-Colonel Issaac Zida made the announcement in the central Place de la Nation in Burkina Faso’s capital Ouagadougou.
In a statement Mr Compaore called for a 90-day transition to “free and transparent” elections in the west African country.
“I declare a vacancy of power with a view to allowing a transition that should finish with free and transparent elections in a maximum period of 90 days,” said the statement, which was read on local radio and television by presenters.
Burkina Military Chief General Navere Honore Traore has said he has taken over as head of state.
In a statement General Traore said “in line with constitutional measures, and given the power vacuum… I will assume as of today my responsibilities as head of state.”
Tens of thousands of people had gathered to demand Mr Compaore’s resignation after violent protests in the country yesterday.
French president Francois Hollande has welcomed the resignation of Mr Compaore, calling for rapid, democratic elections to find his successor.
Separately, Omega radio in Burkina Faso reported that Mr Compaore had issued a statement announcing his resignation and saying that the head of state’s position was now vacant.
Earlier, an army official claimed that Burkina Faso’s embattled President had been ousted.
“Compaore is no longer in power,” Colonel Boureima Farta told tens of thousands of protesters who erupted in cheers in front of the army headquarters.
Mr Compaore had vowed to stay in power at the head of a transitional government until after elections.
His decision came despite opposition calls for him to step down immediately following a day of violent protests.
General Traore, had earlier dissolved parliament and announced talks with all political parties to create an interim government to take the west African country to democratic elections within a year.
The move came after at least three protesters were shot dead and scores wounded in clashes with security forces.
Demonstrators attacked the homes of senior members of the ruling party and symbols of Mr Compaore’s long rule.
Hundreds of people had earlier stormed parliament, looting the building and setting it on fire, while others ransacked state television, forcing it off the air.
Protests also gripped Bobo Dioulasso, Burkina’s second-largest city, and other towns across the gold and cotton-producing country.
Mr Compaore, who seized power in a military coup in 1987, said he had dissolved his government and was lifting martial law that was announced earlier in the day.
He also scrapped plans for an unpopular constitutional amendment that would have allowed him to seek re-election next year, a prospect that had sparked yesterday’s protests.
Regional West African bloc ECOWAS had said earlier yesterday that it would not accept any party seizing power through non-constitutional means – suggesting diplomatic pressure to leave Mr Compaore in place.
A delegation from the African Union, the United Nations and ECOWAS was due in Burkina Faso today to hold talks with all parties involved.