Contugesic ( unsure of the spelling), 60mg dihydrocodeine, Codeisan, 30 mg codeine phosphate and various brands of benzos are widely available in Spain. But they become harder and harder to buy OTC, especially if your Spanish leaves something to be desired.
A simpler alternative to traipsing round the farmacias is to take advantage of the walk-in surgeries that have sprung up on every tourist strip. For 10 or 20 euros an obliging doctor will satisfy all not-too-ambitious requests with a minimum of questions and sign a prescription on the spot.