Staff Sergeant Joaquin Moya Espejo, 35, was struck by a bullet in the chest while on a patrol with Afghan forces northeast of Ludina in northwestern Badghis province, it said in a statement.
Spanish Defence Minister Carme Chacon will travel to Afghanistan to obtain more information regarding the soldier`s death and repatriate his remains.
Spain plans to withdraw all of its 1,500 troops serving in the NATO-led International Security Assistance Force in Afghanistan by 2014.
The Spanish troops are training Afghan army personnel. (*)