At least eight foreigners and seven locals were among those killed in Sunday's evening attack on the Aziz Istanbul cafe, the government added.
The gunmen, thought to be jihadists, fired on customers on the terrace before making their way inside.
Two attackers were killed in a siege which lasted into the morning.
President Roch Marc Christian Kaboré condemned the "cowardly terror attack", saying the people of Burkina Faso would not give in to terrorism.
The foreigners killed include two Kuwaitis, and one each from Canada, France, Lebanon, Nigeria, Senegal and Turkey, Burkina Faso's Foreign Minister Alpha Barry said. However, Canada's foreign minister said two Canadians had died.
Three victims have not yet been identified, Mr Barry said.
A jihadist attack on a nearby cafe in January of last year killed 30 people.
There are fears that the latest attack is the work of one of the affiliates of al-Qaeda that are active in the Sahel region, the BBC's Alex Duval Smith reports.
The shooting began shortly after 21:00 (21:00 GMT) at the cafe, popular with expatriates, on Ouagadougou's busy Kwame Nkrumah Avenue.
Security forces launched a counter-assault at 22:15 and the shooting ended at about 05:00 on Monday.
Police captain Guy Ye told the Associated Press news agency the attackers had arrived on motorcycles and had begun shooting randomly.
One eyewitness told the BBC: "I saw there were multiple trucks or jeeps driving through my street, with... local army/police officers with AK47s, deploying in front of my house.
"I heard a lot of shootings and then I was scared as hell and I went inside. I've been hearing quite a bit of shooting."
Burkina Faso: at least 18 dead in restaurant attack
At least 18 people have been killed in an attack by suspected Islamist militants at a restaurant popular with foreigners in the capital of Burkina Faso.
There was no immediate claim of responsibility for the assault on Sunday night in Ouagadougou. The communications minister, Remis Dandjinou, said 18 people had been killed, both Burkinabes and foreigners, with about 10 injured.
Security forces killed two assailants in a counter-assault that went on until Monday morning. It was not clear how many gunmen were involved.
Dandjinou had earlier said that “some people were held” by the assailants and that “some were released”, but gave no further details.
Canada’s foreign minister, Chrystia Freeland, said two Canadians were among the dead. Turkey said one of its citizens was also killed, while Paris prosecutors said at least one French national died.
Earlier, the Burkina Faso foreign affairs minister, Alpha Barry, said at a news conference that seven Burkinabes, two Kuwaitis, a Nigerian, a Senegalese, and a Lebanese were also among the dead.
Analysts say a coalition of jihadist groups formed last month is the prime suspect. The alliance includes al-Qaida in the Maghreb (AQIM), one of the most tenacious and effective offshoots of the extremist organisation.
A government statement described the latest deadly shooting as a terrorist attack, while President Roch Marc Christian Kaboré condemned it as “a despicable attack that has Ouagadougou in mourning”.
“The fight against terrorism is a long-term struggle,” he said on Twitter.
Guy Ye, a police captain, said three or four assailants had arrived at the restaurant on motorbikes at about 9pm, armed with AK-47s, and began shooting at diners.
One woman said she was in the restaurant celebrating her brother’s birthday when the shooting started. “I just ran but my brother was left inside,” she told Reuters.
Burkina Faso, a landlocked nation in west Africa, is one of the poorest countries in the world. It appeared to have escaped the worst of the wave of Islamist militant violence that has swept other parts of west Africa and the Sahel in recent years, including neighbouring Mali, but has been increasingly targeted by militant groups since 2015.
In January last year, 30 people died in an assault by AQIM-linked extremists on a hotel popular with UN staff and foreigners in Ouagadougou. The three attackers were of foreign origin, according to AQIM, which claimed responsibility in the aftermath along with the jihadi group al-Mourabitoun.
The two groups have now combined with a third in a coalition. Though based in Mali, the new alliance has struck neighbouring countries and claimed one attack in Burkina Faso last month.
“It is very difficult to say definitively who is responsible for this new attack but precedent would suggest the involvement of AQIM,” said Ryan Cummings, a security expert based in South Africa.
Cummings said AQIM had the motive – Burkina Faso has been supportive of French military operations against jihadist in the region and also hosts French interests – and is one of few groups with the capacity to carry out such an assault.
A new force of 2,800 troops from local states supported by the French and focused on border security is due to begin operations later this month.
The French president, Emmanuel Macron, condemned the assault, calling it a terrorist attack.
One factor driving the violence in the region is the rivalry between jihadi factions. The new alliance is aimed at overcoming “political and ethnic differences and presenting a united facade”, said Cummings.
Other factors include the activities of criminal networks, tensions between pastoralists and farmers, political vendettas and ethnic rivalries.
There is also a homegrown terror threat in Burkina Faso, from a preacher, Ibrahim Malam Dicko, who radicalised his followers and has claimed recent deadly attacks against troops and civilians. Last month, five people were killed in a series of attacks launched by Dicko’s group in the northern province of Soum.