Don't waste valuable time traveling long distances between places. Apparently you have about 10 days. Suggest that you stay in Portugal.
There is much to see. In the Lisbon area, take a day trip to Evora with is many ancient Roman sites; Caiscas is worth a half day. Also, Sintra, not far away. Obidos is a very small city with its ancient Roman wall.
Porto deserves a couple of days, in addition take the train up the Douro River Valley. The tracks run on the north bank of the amazing river valley. Stay in Regua and Pinhao. The Douro valley is perhaps the most scenic in Europe.
If you insist on going to Spain as well, you will find travel to Seville more difficult. There once was an overnight train between Lisbon and Madrid. Not sure that is still the case. There is a high speed rail train from Madrid to Barcelona. Still you don't allot much time in the Madrid or Barcelona area, so plan on coming back and doing Spain on another trip.