You're overthinking it.
> REALITY ON THE FIELD
When it comes to attractions, the reason they ask for your passport or ID isn’t to confirm who you are fully. They just want to make sure the person holding the ticket is the same one who paid for it, so nobody’s trying to game the system. Same thing with discounts like senior rates, they just need to check you’re actually over 65. In these cases, if the info on your passport mostly lines up with the booking and it’s clear enough you’re the same person, that’s usually fine. Plus, everyone knows different countries format names their own way, with middle names, different orders for surname and given name, and all that. We, for example, don't have middle names, but we have two surnames instead.
Hotels and other accommodations are a whole different story. There, the request comes from the Spanish Ministerio of Interior, kind of like Homeland Security, and hotels have to follow EU-wide rules that have been around for decades, stricter in some places than others. The point is to keep track of who’s in the country for things like terrorism and organised crime. In these cases, your passport name must exactly match the booking. If there’s any doubt, the place might refuse check-in because they can get hit with fines up to 30.000 euros if they don’t give the Ministry every bit of required info, and the latest update to the law a few months ago made that list even longer.
> PROVING WHO YOU ARE
And just as a reminder, the only legal ID for a foreigner (tourist) in Spain is the passport. That’s it. No library cards, no random driving permits from back home. If you’re an EU citizen, you can also usually use your national ID card or your driver’s licence, as long as it’s the standard EU format -the latter, to my knowledge, isn't valid for air travel nor passport control at the airports or any other police matter though.
> WHILE IN THE COUNTRY...
And while we’re at it, it’s worth remembering that, legally, every tourist in Spain has to carry some valid form of ID at all times, same as residents. Police are allowed to ask for identification on the spot. In plain terms, you should have your passport on you, or your national ID card if you’re from the EU. If you don’t and they can’t confirm who you are, they can take you to the station until everything gets cleared up, which can be a massive waste of time. That’s what the law says.
Now, in real life, it’s insanely rare for police to randomly stop someone and ask for ID. Not for tourists, not for people who live here, unless you’ve done something really wrong or something serious has just happened in the area, and they’re checking everyone around the scene. I’m from here, and honestly, I don’t know a single person who’s ever been asked for ID out of nowhere. Of course, it also depends on the circles you hang out in, LOL!
Carrying a photocopy of your passport is probably the most practical option. A photocopy isn’t a legal document, but for almost anything you’d run into in a normal day it’s good enough. Things like proving you’re a senior, confirming your identity at a shop if you’re using an old credit card without chip and PIN, and so on. It also really helps in case something happens to you, and you end up being taken to a hospital unconscious, especially if you’re travelling on your own. Having at least a copy of your passport on you makes it way easier for them to figure out who you are and contact whoever they need to.
Enjoy!