The standoff ended at daybreak with all four attackers killed, a government minister said, reporting no civilian or military casualties.
The attack was claimed by the Taliban, who are intensifying their annual spring offensive despite repeated overtures from the government about opening peace talks
“Four militants who had one RPG launcher, three AK-47s and one grenade launcher were killed,” deputy interior minister Mohammad Ayoub Salangi said on Twitter.
Sporadic blasts were heard hours after the assault began late 26 May in the upmarket area of Wazir Akbar Khan, home to several foreign embassies and a prime target for attacks.
“We have surrounded the area and cornered them,” Kabul police spokesperson Ebadullah Karimi said.
The Taliban, waging a 13-year war against the US-backed Afghan government, on 26 May killed 26 Afghan police in multiple attacks in the volatile south.
The militants have launched a series of attacks in the capital and around the country as NATO forces have pulled back from the frontlines.
The surge in attacks has taken a heavy toll on civilians, as per United Nations Assistance Mission to Afghanistan. In the first four months of 2015, civilian casualties jumped 16 percent from the same period last year, it said.