Spain vs Portugal—help me choose

We really enjoy going to some out of the way places and love hiking on vacation. Re Cordoba, we could also stop there for the day on our way back to Madrid. Which would mean no Prado but they do have a patio decorating contest going on which is supposed to be very pretty.