I have been to Spain several times, and my favorite cites were Barcelona, Seville and Valencia. Granada, Cordoba, Cadiz and Madrid, Segovia are ok.
It kind of depends on your style of travel. The last time, which was just a month ago, we had a short time line, so we did a city a day, see the main sights etc. With the high speed trains of an 1.5 hours, and knowing where to go, you can get a lot out of a single day. But I would more time in Barcelona and Seville in particular.
If you want to hang out, Valencia and maybe Cadiz are best. Seville, Barcelona, and Madrid are so overwhelmed by throngs of tourists, it was not fun to hang out. Granada and Segovia have some wonderful sites (the Moorish castle and the Roman aqueduct), but the cities are otherwise not that wonderful to hang around. Segovia is not necessarily an easy day trip since the train arrives outside the city and you need to take a bus from train station to the city.
If you want to hang out in smaller towns, there are many many smallish places you can reach from Seville or Valencia - albeit by bus in most cases. There are also coastal places an hour from Barcelona or near Malaga.