I was told that there is a fine of €300 for cycling on a "carretera" in Spain without a helmet. But it's possible the guy just wanted to sell me a helmet. I'm not completely sure what exactly distinguishes a carretera from any other road, but on this trip, I don't have that helmet with me and several police have seen me riding.
A web search gets more advertisements than information. Anyone know what the law is there? Extra credit if you have a link to the official text. (I can read Spanish.)