We were in Spain last year at the same time. We flew into Madrid, spent the night to adjust after the transatlantic flight, then took the train to Valencia for 2 days/2 nights. Valencia was amazing, but as others mentioned, it’s a bit too far for a reasonable day trip. If you are a beach goer and want to get away from the crowds without too much effort, Valencia is a great spot for that. We then took the train to Barcelona, spent three nights there. Personally, I wish we had spent less time in Barcelona. I prefer to experience the culture of the places I travel to, and we found Barcelona so incredibly touristic that it was difficult to get a sense of the Catalonian culture. We found Barcelona incredibly expensive compared to Madrid (more on that in a moment), and the food wasn’t as good (again, just my humble opinion!). Honestly I felt continuously gouged, and was pretty happy when it was time to go. The Sagrada was amazing, and the gothic quarter was my favourite part (we just walked in the opposite direction of the crowds and found some cool shops showcasing work by local artisans, bought some cool artwork, etc.)
We then made our way back to Madrid for another four nights, which for us, was the perfect amount of time. Madrid stole my heart. I absolutely love that city, and would go back in a heartbeat! We rented a flat in la Latina, and we were there for the huge market (I think it happens on Saturdays). Street art and performers, amazing food at unbelievable prices, and we found the people to be incredibly friendly!! Tons of great shopping, Chatted with a lot of wonderful and colourful locals, checked out a couple of tourist attractions, but mostly kept away from the crowds.
We took a day trip to Toledo and that was another major highlight for both of us. Make the trip up the steep incline - there are shuttles and taxis if you don’t want to do the walk. The view is breathtaking, and we stayed up there for quite awhile enjoying a beverage at one of the cafes and taking in the sites. I left a little piece of my heart at the top of that hill; Toledo is truly a holy place and a must see!!
If I could do the trip again, I would have spent less time in Barcelona and used that extra night to spend the night in Toledo (to be there in the early morning/late evening without the day trip crowds would have been truly magical!). Again, just my humble opinion; everyone has a different travel style!!