score:3
It looks like this is allowable:
From: https://www.spth.gob.es/faq?tab=2
If the transit in Spain is carried out without leaving the international zone, you will not be required to present a AIDT. If the transit involves passing through border control centres and therefore entry into Spanish territory, they must present the boarding card or purchase ticket for the next flight or flights of the connection to demonstrate that the final destination is international, and they may continue their journey, provided that the transit lasts less than 24 hours and they do not leave the airport premises.