I (British citizen) married my husband (Irish citizen) in Malaga in 2002 and we were not resident at that time and had to jump through various hoops but did get married in the local office by the local judge or mayor or some such person!
HOWEVER - upon moving to Madrid we wanted to buy a house together, the Notary (on the day of final singing) said that since we were non resident at the time of our marage they would not recognize our marriage under the laws of Spain and hence we could only be 50/50 owners of the house with either of us having to pay inheritance tax if something were to happen - unlike a married couple where i believe no inheritance would normally be due for the property you live in as man and wife. I never really understood what he meant since we even have a Libro de Familia and a spanish marriage certificate, and with it being the day of signing didn’t want to delay anything. But we are discussing getting some advice and maybe even getting married again but the problem is my husband has diplomatic status and so although i am resident he is not and so we might be left in the same situation, perhaps we have to get married outside of Spain for it to recognised!
Who knows! the joys of living in Spain! Loving every minute of it, there’s a new battle nearly everyday, it can, seriously, ONLY get easier - right?