I saw this question posed on a local forum and researched it:
DO I NEED TO WEAR A HELMET WHEN CYCLING IN SPAIN?
The short answer is YES, all cycle users should wear a helmet, children and adults.
The longer answer is that according to the latest law, it is compulsory that those under 16, as riders always use bicycle helmet protection wherever they ride.
For riders over 16 years of age, the use of helmets is compulsory on intercity (out of town) roads and it is advisable in urban areas.
As with many Spanish laws, this makes interpretation a little difficult. How I understand it is, if you are out of town (speed limit generally over 50 kph) wearing a helmet (casco) is compulsory as an adult.
Knowall’s advice: If you value your life and your head, wear a cycle helmet at all times when cycling, in or out of town. I do!
Source of info: DGT Ministerio del Interior website