To clarify:
Broadly speaking...
In SPAIN, the law states one needs to carry a "valid form of ID" at all times. Period. This applies equally to residents and non-residents. The police can ask you to produce it at any time anywhere. If you don't carry it with you, and depending on the circumstances and why you were asked to produce it, you might be taken to the Police station until your ID has been proven. The only valid forms accepted for non-EU citizens are the national ID card -if your country has one recognized abroad- or the passport. Photocopies are not a "valid form of ID". For US citizens, your state driving licenses are not valid forms of ID. Remember that British are no longer EU citizens.
I said broadly speaking... cause that's what the law states.
Then there's reality...
Only if you are embroiled in an "incident" -you know what I mean!- the Police will ask you to produce your ID. Also, if there has been a major incident in the area and you happen to be there (ie a shooting, a terror attack, when you seem to match the ID of a potential culprit of a crime that happened nearby, etc.). For the vast majority of us (locals and visitors), we will very unlikely have to produce our IDs ever.
No one else (private business, etc) can legally ask you to produce your ID, only the Police. Having said that, some businesses and other government institutions (ie City Hall) may ask you to prove you are who you claim to be by producing a "form of ID" when, for example, taking advantage of a discount for a ticket to a museum or a train. This is not necessarily a rule, some may ask others may not. Also, if you're paying with an old credit card (nowadays in Europe we all have pin&chip cards), you may be asked to prove ID by showing your passport or national ID. In these cases, a photocopy might be accepted -at the business's discretion. Some US-issued cards still don't adhere to international security standards and have no pin&chip. Check with your bank before travelling :) And claiming to be from this or that country bears no difference: all customers are treated equally in this respect.
So,
Understanding the headaches involved with losing one's passport when travelling, I always advise keeping it in the safe at the hotel and carrying a photocopy of it. In most cases, if you need to prove your ID, this will most likely suffice.
But one needs to be aware it might not and then, either you won't have that discount, or you won't be able to buy that item with a non pin&chip credit card.... or, if your beef is with the Police you might be asked to accompany them to the Police Station. Then someone will need to go to your hotel to pick up the passport and take it to the station.