At least 30 people were killed and more than 300 wounded in a Taliban suicide bomb attack on a government security building in the centre of Kabul today, the health ministry said, the worst attack in the Afghan capital in almost a year.

"At least 30 people have been killed and 327 injured, most of whom are civilians, were wounded in the attack," said Ismail Kawosi, a spokesman for the ministry. Many of the wounded were in critical condition he said.

The blast during the morning traffic hour was easily the biggest in Kabul since a truck bombing wounded 240 people last August, and was the first in the capital since the Taliban declared the start of their spring offensive last week.

President Ashraf Ghani condemned the attack "in the strongest possible terms" in a statement from the presidential palace, only a few hundred meters away from the scene of the blast in central Kabul.

The attack began with a suicide car bomb during the height of the morning rush hour, and security forces and militants then exchanged gunfire, Reuters witnesses near the scene said.

Pictures showed windows blown out at the front of an office that houses a National Directorate of Security (NDS) unit.

The Health Ministry said civilians and members of the Afghan security forces were among those caught in the attack.

The casualty numbers were expected to rise, said ministry spokesman Ismail Kawosi.

The Taliban announced the beginning of their spring offensive on April 12, and fighting has raged around the symbolically important northern city of Kunduz since then, although the capital had been relatively quiet.

Kunduz, Afghanistan's fifth-largest city, fell briefly to the Taliban last September in the biggest blow to Ghani's government since NATO-led forces ended their combat operations at the end of 2014.

The Taliban said on their Pashto-language website that they had carried out the suicide bombing on "Department 10", an NDS unit which is responsible for protecting government ministers and VIPs.

They said a suicide car bomber blew up the main gate at the front of the office, allowing other fighters, including more suicide bombers, to enter the heavily guarded compound.

Taliban spokesman Zabihullah Mujahid said in a separate statement that the attackers were engaged in a gunbattle with Afghan security forces inside the building.

It was not immediately possible to verify the details of the Taliban's claim with government officials. The Islamist group often exaggerates details of attacks against government and military targets.

The Taliban-led insurgency has gained strength since the withdrawal of most international combat troops, and the Taliban are believed to be stronger than at any point since they were driven from power by U.S.-backed forces in 2001.

A thick plume of black smoke was seen rising from the area near the sprawling U.S. embassy complex in the center of Kabul immediately after the blast.

Warning sirens blared out for some minutes from the embassy compound, which is also close to the headquarters of the NATO-led Resolute Support mission.

The U.S. embassy and the NATO mission both said they were not affected by the blast.