The killed included two Spanish citizens, one Afghan civilian, five police personnel and four attackers, Xinhua reported.
"Around 6.00 p.m. (local time) on Friday, one terrorist detonated a car bomb at the entrance of a guest house in Shairpoor locality, enabling three other attackers to enter the building," Xinhua quoted the Afghan Interior Ministry as saying on Saturday.
"Police force arrived at the site shortly after the attack, and launched a counter-offensive against the terrorists," the ministry said.
A total of 12 guests trapped in the building were rescued by the police, the report said.
"The clash ended around 5.30 a.m. on Saturday. As a result of the terrorist attack, four police personnel were killed and seven civilians sustained injuries while four attackers were killed," according to the statement.
Read More: Taliban set for another succession battle
"At first, I thought earthquake occured. Then everywhere it became dark due to smoke. After the smoke I found that all the windows of my house were shattered by a blast. My children were shocked and they began to cry," resident Mohammad Murtaza said.
"We stayed at our basement and failed to sleep all the night. Thanks god, none of my family members were hurt by the clashes and flying bullets," he said.
Taliban militants have claimed responsibility for the attack.
The Taliban-led insurgency has been rampant since April when the militant group launched its annual rebel offensive in different places of the militancy-plagued country which had claimed hundreds of lives including militants, security personnel and civilians.
Taliban has urged civilians to stay away from official gatherings, military convoys and centres regarded as the legitimate targets by militants besides warning people not to support government.
Zabiullah Mujahid, a purported Taliban spokesman, said the attack was part of the Taliban's offensive called Azam.