Afghan security forces have killed all the insurgents involved in the attack on a guest house near the Spanish embassy in Kabul, Interior Minister spokesman Sediq Sediqqi said on Thursday.
A Spanish security officer was killed in the attack, in a heavily protected part of Kabul close to several embassies and government buildings. At least seven people were treated in a nearby hospital run by Italian aid group Emergency, mainly for minor injuries.
Attackers blew up a car bomb late on Friday afternoon before at least three gunmen entered a compound and battled security forces for hours, with gunfire and explosions heard intermittently until late into the night and early morning.
In a message posted to his Twitter account, Sediqqi said all of the attackers had been killed.
The Taliban claimed responsibility for the attack, just days after President Ashraf Ghani returned from a regional peace conference in Pakistan, where he sought support to revive peace talks that stalled this year.
It followed a separate Taliban attack on the airport complex in the southern city of Kandahar, in which at least 50 civilians and security forces personnel were killed.