Dear K.,
I am fairly often asked for my identification either when I load gas or when I buy. Not always, but at least 50% of the times, depending on where you buy.
I would prefer it to be a 100%, but ...
However, be on alert with thieves. There have always been some close to the most touristic central areas, but now, with south american inmigratio, it has boomed. Several friends of mine (foreigners) have suffered it, since foreigners are a good prey, for they will never more meet the thief, they carry more money on them, and if there is a trial, they are not coming from their countries.
Be specially careful at Puerta del Sol and Gran Via/Callao.