A Spanish citizen may
enter Spain with an expired passport or ID card once the border control authorities have checked the authenticity of the document and that the identity and nationality of the person match the data appearing on the document they are carrying.
If travelling within the Schengen area, border checks are not carried out at internal borders between Schengen States, other than in exceptional circumstances (see
Articles 25 to 29 of the Schengen Borders Code
).
Before
leaving Spain you should check the documents needed and requirements for entering the destination country. However, as a general rule, to cross an external border you must carry a valid passport or another valid travel document.
See
https://administracion.gob.es/pag_Ho...are%20carrying.
Under the Spanish legal system,
entering Spain with an expired passport or ID card is not an offence.
With regard to
leaving, you must cross an external border (to a third country) at an authorised border post with a valid passport or travel document. However, if travelling within the Schengen area, border checks are not carried out at internal borders between Schengen countries, other than in exceptional circumstances.
However ,the carrier needs to be in the loop. They must have had this a lot post pandemic so it wont come as a surprise.