I think is it good to visit on October / November. Spain is big and the amount of rain would depends on the area that you are visiting. I think in the south should be ok and temparature will be good.
Spanish railway network is good and you can easily go to different cities by high speed trains, that shouldn't be so expensive as now there are 4 companies operating the network. Connection between Spain and Portugal currently is mainly by plane.