"This is a terrorist attack," Communications Minister Remi Dandjinou told a news conference on Monday.
He said the toll was provisional because the security operation was still underway.
Burkina Faso, like other countries in West Africa, has been targeted sporadically by jihadist groups operating across Africa's Sahel. Most attacks have been along its remote northern border region with Mali, which has seen attacks by Islamist militants for more than a decade.
A 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," the woman told Reuters TV as she fled the building.
Earlier, authorities had suggested that three assailants had been killed, but the minister later revised down that figure and gave the death toll of victims as 18.
Thirty people were killed when gunmen attacked a restaurant and hotel in Ouagadougou in January 2016 in an incident claimed by al Qaeda in the Islamic Maghreb (AQIM).
French forces intervened to prevent them taking Mali's capital, Bamako, the following year, but they have since gradually expanded their reach, launching high-profile attacks on Burkina Faso and Ivory Coast.
A new al Qaeda-linked alliance of Malian jihadist groups claimed an attack in June that killed at least five people at a luxury Mali resort popular with Western expatriates just outside Bamako.
African nations launched a new multinational military force to tackle Islamist militants in the Sahel last month, but it will not be operational until later this year and faces a budget shortfall.