"since last june any card bought in a EU country works without extra costs* in any of the other 27 countries."
The "works" part has always been true, but "without extra costs" needs to be qualified. What IS true is that whether you have a "plan" (i.e. contract) with a Spanish service-provider or just buy prepaid cards, if you use your phone, with a Spanish phone number, outside Spain, but within not just the EU but the EEA (27 other EU countries plus e.g. Norway), you will be charged as if you were using it in Spain.
The limit slatkin_10 was trying to remember is 3 months, i.e. 90 days. But this is probably not a problem in your case, if you would be largely staying in Spain but travelling to other countries on several weekends.
What a lot of people don't realise is that "roaming" means using your phone in a different country from the one its SIM card (phone number) is from, e.g. using your Spanish SIM in France (= "abroad"). Whether this is to phone Spanish, French or any other numbers, you will be charged as if you were using your contract/card in Spain. But what ISN'T affected by EU/EEA roaming price rules is making international calls FROM your phone's home base (Spain) to any other countries, including those in the EU/EEA. .
Normally, you should not be able to conclude a contract for a phone/data plan until you have registered as a resident of Spain (I presume you are aware that when staying for more than 3 months, you have to register at the Oficina de Extranjeros / Police station in order to obtain a residence certificate and NIE number (Número de Identificación Extranjero). Until then, you will have to carry your passport and this will be required as identification for purchase of prepaid phone cards.
There are various service providers, see https://www.justlanded.be/english/Spain/Spain-Guide/Telephone-Internet/Mobile-phones and https://www.expatica.com/es/moving-to/spain-sim-card-spanish-mobile-networks_1019515.html - but there is no point in trying to establish now what would be your best option in 6 months' time as offers vary all the time (although you could look up current deals with those providers). See also https://jeangalea.com/best-pre-paid-phone-card-spain/