"This is usually a non-combat zone but this time according to the Afghan national police, there were RPGs, rocket fire and a suicide bomber. Isaf police have told us that things are very sketchy," Al Jazeera's David Chater, reporting from the capital Kabul, said.
"Earlier this month, we do know that a suicide bomber was picked up in this area ... so things are developing in the Herat area."
An Afghan commander told Al Jazeera that the attack had been carried out in response to an incident in August in which at least 90 civilians, mostly women and children, were reportedly killed in a US raid.
Violence has increased steadily in Afghanistan in recent months as the Taliban, who were in government between 1996 and 2001, have grown in strength.
Spain has about 700 military personnel based in Afghanistan, most of them in Herat province.
The latest attack brings the number of Spanish troops killed in the fight against the Taliban to 25, while the total number of foreign military deaths in Afghanistan since the Taliban government was toppled is more than 1,000 soldiers.