If that is your only train travel then first place is to look for the price of regular tickets.
https://www.renfe.com/es/en
Just like most other modes, the prices are flexible so what you see today may change.
RENFE offer their own pass, this is valid for a specific number of journeys, 4, 6, 8 or 10 over a period of 1 month, available in either standard or comfort (premium)
https://www.renfe.com/es/en/viajar/prepare-your-trip/abonos-ave-y-largadistancia/renfe-spain-pass
4 journey in comfort is €270.
Once bought you can then book seats online with no extra charge, a facility to change the booking is also available.
An Eurail one country-Spain pass is €263 for 4 days in 1 month, this gives unlimited travel on each day selected but there is a reservation fee of €10 on all long-distance trains in Spain.
As well as that there is an inability to book reservations for these online, booking from a Spanish train station counter is the only method, You can also “pre-book” by phone no more than 3 days before you are able to collect from a Spanish ticket office. This will hold the space but lapse if not collected within the 3 days.
https://www.eurail.com/en/eurail-passes/one-country-pass/spain#/
Do your calculations and decide which fits your plans best.