Hi,
There are plenty of places to visit in Spain loaded of history and very nice in Xmars.
The more the south the warmer. Mediterranean sea water is warmer than Atlantic ocean water.
If you go to Madrid, of course there is no beach, but it's plenty of stuffs to do, and there are some cities near Madrid plenty of history. I recomend you lay a visit to Toledo or Segovia.
If you want to head to the very south, I recommend Seville, Cordoba and Granada.
Granada is amazingly beautifuk IMO. Aside of a city with a big arabic influence, you can visit the Alhambra palace. Very close to Granada you have ine of the best sky stations in Spain, Sierra Nevada, plus you also got the bech pretty close.
Barcelona is also beautiful and it's right next to the coast.
Maybe, in your way to the spot of your choice, you can pass by Burgos, León, Salamanca..... Salamanca is a very nice place, plenty of students, history.
If yiu decide to head to Galicia, at the north west, the ocean water migth be very cold, and the weather pobably a little miserable, but there ade nice places to visit as Coruña, Santiago de Compostela.
A plus in Spain: if you love your food, you can have very good food for cheap virtually anywhere. And if you like wines, the whole country produces lot of very good and different ones (we usually don't drink imported wines)