Spain. The first thing to know is that in your 60's you can buy Renfe's (train) tarjetas doradas for about €6 each once you get to Spain. These cards entitle you to discounts on fast trains of 25%-40% - depends on type of train and day of the week. You can also buy discounted tickets up to about 2 months in advance (usually no refund/no change). This article explains it all. If you are 65, you can get discounts at many sights.
Portugal I haven't been yet, but good friends went, loved Porto and surroundings, weren't super keen on Lisbon. Anyway, the north seems to be a much more interesting area to explore.
Consider starting in Portugal and ending in Barcelona. Since it's on the Atlantic, weather may be significantly better at the beginning of October than at the end of the month. The best way to get between the countries is by air. You can go to the wiki page for any airport and see a table with all the airlines and destinations from it. I would plan 8-10 days in Portugal and the rest in Spain.
Madrid is the city I find least interesting. But I love the Prado and the Thyssen-Bornemisza. If you add the Reina Sofia, that's 2 full days - if you love European painting. If not . . . Madrid is convenient for day trips to Segovia and Toledo, but Toledo is much better as an overnight (or 2N). In Madrid I like the Europa Hotel, modern, comfortable, great location. In Toledo I stayed at La Posada da Manolo, quiet area, very near the cathedral, walking distance to the busy center.
Most people seem to visit Cordoba as a day trip, either en route between Madrid and Sevilla, or as a day trip from Sevilla. That's enough to see the must-see Mezquita and a little more. However, this is my favorite Spanish town and well worth at least 2N. It has one of the best preserved medieval centers, and is a lot quieter (low-key) than nearby Sevilla. Sevilla has the best tapas in Spain, a beautiful Alcazar and much more. I love staying at the Amadeus - a very special hotel with wonderful staff and an excellent location.
The best way to see the pueblos blancos is by car. I based in Ronda and tootled around in a different direction each day. The driving was easy, the roads are scenic (with pull-outs for photo ops) and you can choose which villages you want to enter and explore, though driving in some of them is challenging (think San Francisco steep with very narrow streets and sharp blind corners). You can rent a car when you leave Sevilla and drop it when you get to Granada. For something different, you can spend several hours hiking in El Torcal and/or stop on the outskirts of Antequera ( and also worth several hours to explore the old town) to see the prehistoric dolmens.
Granada doesn't yet have high-speed train service (long, long story). It takes about 4.5-5 hours to get there from Madrid by bus or train, much longer to Barcelona. The recommendation here on the forum is to fly between Granada and Barcelona.
Barcelona - a week is not too much. Lots to see and do, plus great day trips.
There's much more than what I've listed but you've only got 4 weeks :-)