Four attackers targeted the complex in the central Shar-e-Naw neighbourhood, the Afghan interior ministry said.
A bomber blew himself up at the gate of the embassy, and three others entered the compound. No information has been provided about casualties.
So-called Islamic State (IS) said it carried out the attack.
Kabul has seen a number of deadly assaults this year blamed on either IS or the Taliban.
Correspondents say this is the first attack on the city’s Iraqi embassy. It comes two weeks after the embassy held a news conference to celebrate the defeat of IS in the Iraqi city of Mosul.
“Our forces are inside and a clearance operation is underway,” said Afghan interior ministry spokesman Najib Danish.
Pictures on social media show black plumes of smoke rising into the sky.
The Iraqi foreign ministry said its top diplomat in Kabul was evacuated to the Egyptian embassy, but attempts were under way to remove two other embassy employees.
The Afghan interior ministry had earlier said all staff had been evacuated.
According to the United Nations, Afghanistan has seen at least 1,662 civilian deaths in the first half of the year, with about 20% of those in the capital.
On 31 May, a huge bombing in the centre of the city killed more than 150 people, the deadliest militant attack in the country since US-led forces ousted the Taliban from power in 2001.
The violence underlines the precarious security situation in Afghanistan as US President Donald Trump weighs up whether to increase the number of US troops aiding the military and police in the country.
IS announced the establishment of its Khorasan branch – an old name for Afghanistan and surrounding areas – in January 2015. It was the first time that IS had officially spread outside the Arab world.