Eight security personnel and eight attackers were killed in the fighting while 80 people including civilians, were wounded, officials say.
French Foreign Minister Jean-Yves le Drian said there was no doubt it was an act of terrorism.
It is was not immediately clear who had carried out the attack.
Burkina Faso Security Minister Clement Sawadogo said there had also been a suicide car bomb attack at the military HQ that may have intended to target a regional anti-terrorism meeting.
A room was destroyed by the blast, he said, but the meeting had been moved to another location.
Analysis by Lamine Konkobo, BBC Afrique
There have been rumours of an attack in Burkina Faso for some time, and these even prompted a recent security forces reshuffle.
But this is far bigger than what most people had expected. An attack on the military headquarters strikes at the heart of Burkina Faso’s security establishment, while the French embassy is normally one of the safest places in the capital.
Since Emmanuel Macron came to power, France has been trying to mobilise its former colonies in West Africa, and the United Nations, to tackle the Islamist militant groups which operate in the Sahel region south of the Sahara. But, so far, progress has been slow.
This attack may concentrate some people’s minds.
Early pictures from the scene showed a cloud of black smoke rising into the sky. Witnesses reported seeing armed men getting out of a car and opening fire before heading towards the embassy.
Ouagadougou Mayor Armand Béouindé told France’s Le Monde newspaper that the attackers had shot at the town hall and his office windows were shattered. “Apparently, it is a jihadist attack,” he said, but gave no further details.
One witness, Omar Zombre, told local TV: “We saw four people who were trying to enter the embassy on the east side. They were in civilian attire, with a kind of vest and backpacks with Kalashnikovs which were clearly visible.
“So they tried, but they didn’t manage it and so they tried to enter from the west side. We saw that they had set a car on fire. When we went up [to the roof] we heard gunshots from an automatic weapon, [it was] very intense.”
Why is France involved?
The country maintains strong ties with its former colony.
It appears there were no French casualties as a result of Friday’s attack, Mr Le Drian said
“Burkina Faso was the victim of an attack by terrorist groups,” he added.
“It targeted both the institutions of Burkina Faso – because the Burkinabe army headquarters were targeted – and it also targeted France, which is Burkina Faso’s ally in its fight against terrorism.”
French President Emmanuel Macron urged French nationals in the country to follow the embassy’s advice and stay away from troubled areas.
French forces based in the country were also deployed.
Who was behind previous attacks?
This is the third major attack Ouagadougou has seen in the past two years. Islamist militants said they had carried out the other two.
Al-Qaeda in the Islamic Maghreb said it was behind an attack on a restaurant and hotel in Ouagadougou in January 2016 that killed 30 people.
What has happened to al-Qaeda?
France intervened to stop that group taking control of neighbouring Mali in 2013.
But there are numerous other Islamist groups based in the region and militants have carried out attacks in several major West African cities in the past few years.
Burkina Faso also saw a failed coup in 2015. The trial for dozens of the alleged perpetrators began earlier this week but was suspended after defence lawyers walked out in protest against the military court.