The death toll from an attack on a restaurant in Kabul, that was popular with foreigners and government officials, has risen to 21.

Thirteen foreigners, including two British citizens, two Canadians and two US citizens, have been confirmed as being among the dead.

A suicide bomber detonated his suicide vest at the entrance to the Taverna du Liban and two other militants stormed inside and opened fire on Friday evening.

Like many restaurants in the Afghan capital, it ran strict security checks with diners patted down by armed guards and passing through at least two steel doors before gaining entry.

Customers tried to hide under tables when the gunmen burst in and the restaurant's Lebanese owner reportedly died as he returned fire.

Four United Nations staff and the head of the International Monetary Fund in Afghanistan were also killed.

Denmark said one of its citizens had also died.

"Five women were among the dead and about five people were injured," Kabul police chief Mohammad Zahir said.

The assault was claimed by Taliban militants fighting against the Afghan government and US-led foreign forces in the country.

A militant spokesman, Zabihullah Mujahid, said the attack was to avenge a US airstrike in Parwan province on Tuesday night that Afghan president Hamid Karzai said killed seven children and one woman.

"These invading forces have launched a brutal bombardment on civilians... and they have martyred and wounded 30 civilians," he said.

"This was a revenge attack and we did it well, and we will continue to do so."

UN Secretary General Ban Ki-moon strongly condemned the massacre, saying that "such targeted attacks against civilians are completely unacceptable and are in flagrant breach of international humanitarian law".

Afghanistan's interior minister says a number of local officials have been suspended and an investigation has been launched.