Three Spanish tourists and an Afghan national were killed in a shooting in the popular tourism destination of Bamiyan in central Afghanistan, local and Spanish authorities said.

An Afghan Interior ministry spokesman confirmed the four deaths, saying the victims were killed in gunfire in Bamiyan city.

Another four foreigners and three Afghans were wounded, he added.

Spain's foreign ministry said that three of the dead were Spanish tourists, adding that at least one other Spanish national was wounded.

Spanish Prime Minister Pedro Sanchez posted on social media: "Overwhelmed by the news of the murder of Spanish tourists in Afghanistan."

The European Union condemned the attack "in the strongest terms".

"Our thoughts are with the families and loved ones of the victims who lost their lives and those injured in the attack," the body said in a statement.

According to preliminary information provided by hospital sources, the wounded were from Norway, Australia, Lithuania and Spain.

Security forces have arrested four people in connection with the attack.

The Taliban government "strongly condemns this crime, expresses its deep feelings to the families of the victims and assures that all the criminals will be found and punished," the Interior Ministry spokesman said in a statement.

Bamiyan, known for giant Buddhas which were blown up by the Taliban in 2001, is Afghanistan's top tourist destination.