Carry your passport with you at all times
Spanish law requires you to be able to present a photographic identification, should you be asked for it. This may be a passport, driving license or national identity card.
With a tightening of security in the city, it is highly recommended that you have at least a photocopy of your passport with you at all times.