President Roch Marc Christian Kaboré visited the scene on Saturday morning.
Three jihadists, one Arab, the other two "black Africans", were killed at the Hotel Splendid, Security Minister Simon Compaoré said.
No official death toll was issued by 9.00am local time but security sources told the AFP news agency that at least 23 people had been killed.
French ambassador Gilles Thibault later put the death toll at 27 and said that about 150 people from 18 countries had been brought out of the hotel and given primary treatment.
Among the 126 people freed was Labour Minister Clément Sawadago, who had been at the hotel when the attack took place on Friday evening.
Thirty-three of them were reported to be wounded.
Eyewitnesses reported seeing bodies on the terrace of the Capuccino, which, like the Splendid, was frequented by Westerners and UN staff.
The French embassy said on its website earlier that a "terrorist attack" was underway and urged people to avoid the area.
French President François Hollande condemned the "odious and cowardly attack" in a statement.
With Ouagadougou airport closed because of the attack, an Air France flight from Paris to Ouagadougou was diverted to neighbouring Niger.
The Burkinabé army said a heavily armed group of about 20 people had carried out another attack on Friday near the border with Mali, killing two people, a police officer and a civilian, and leaving two others wounded.
Several attacks have taken place in Burkina Faso in recent months but no such assaults had hit the capital.
French special forces are stationed on the outskirts of Ouagadougou as part of the anti-jihadi operation in the Sahel.
The US has 75 soldiers in the country and said it was providing support to the operation.
A similar attack on the Radisson Blu in the Malian capital Bamako less than two months ago claimed 20 lives.