I've lived in Spain for three years after visiting here many, many times. So I've been to a lot of the country.
If you enjoy art museums then Madrid is a must. I deeply enjoyed the
Naval Museum and the
Archaeological Museum in additional to one or more of the three biggies (Prado, Reina Sofia, or Thyssen-Bornemisza).
But I love, love, love Valencia in October. The weather there will be wonderful for exploring all it has to offer. I enjoy biking and it is a great city to bike in. You can get there in six hours with a connection in Madrid. From the great beaches, top notch sites to visit (churches, parks, museums) and incredible restaurants to -what I know you'll find - friendly easy going residents - Valencia is a visitor's dream.
I live an hour north of Barcelona and so you know I love it. But I'd recommend going to Valencia over it because of the time of year. The October weather in Valencia is my favorite time to visit there. You can get up to Barcelona in just a few hours via the train.