A suicide attack claimed by the Islamic State group near Afghanistan's foreign ministry killed six civilians and wounded several others, the interior ministry said.

Security has dramatically improved since the Taliban stormed back to power in August 2021, ousting the US-backed government and ending their two-decade insurgency, but IS has proved an increasing threat.

On Monday, Afghan forces identified the attacker and shot at him in front of a business centre near the foreign ministry, interior ministry spokesman Abdul Nafy Takor tweeted.

"With his killing, the explosives carried by the attacker also exploded which killed six civilians and wounded a number of others," he said.

IS later claimed responsibility for the attack in a statement on Amaq, the jihadist group's news arm.

Italian NGO Emergency, which operates a hospital in the capital, confirmed it had received two dead and 12 wounded, including a child.

Monday's blast was the second attack near the foreign ministry in Kabul in less than three months, and the first since the Muslim holy month of Ramadan began on Thursday in Afghanistan.

On January 11, a suicide bomber blew himself up near the foreign ministry, killing 10 and wounding 53 people, according to the United Nations.

The Taliban authorities, who have often tried to play down attacks challenging their rule, had said that five people were killed in that attack, which was also claimed by IS.

The group has increasingly become a major challenge, killing and wounding hundreds of people in several attacks, some targeting foreigners or foreign interests in a bid to undermine the Taliban government.

At least five Chinese nationals were wounded in December when gunmen stormed a hotel popular with businesspeople in Kabul.

That raid was claimed by IS, as was an attack on Pakistan's embassy in Kabul also in December that Islamabad denounced as an "assassination attempt" against its ambassador.

Two Russian embassy staff members were killed in a suicide bombing outside their mission in September in another IS-claimed attack.

The Taliban and IS share an austere Sunni Islamist ideology, but the latter are fighting to establish a global "caliphate" instead of the Taliban's more inward-looking aim of ruling an independent Afghanistan.