Way back in 2002, we started in Spain, went to Portugal, and finished in Spain, arriving and departing from Malaga. We had a car after landing in Malaga for visiting Ronda and other Andalusian towns, then headed to Granada. From there we flew to Lisbon (cheap flight, and faster than driving), and after visiting Lisbon without a car, rented another one for driving on to Sintra, up to Obidos, then touring Evora and the land of cork trees. We couldn’t afford the time to drive to and from Portugal both ways, but it made sense to have a car one direction. We couldn’t figure a good way to turn in a car in Portugal, cross the border into Spain and pick up another car, and there were 3 of us splitting the cost, so we accepted Hertz’s hefty fee for turning in the car in a different country, but had the mobility that having our own wheels allowed, and on our schedule.
We finished up in Spain seeing more of southern Spain, including Sevilla (parked the car while there), and drove to Arcos de la Frontera but everything was shut the next day due to a surprise labor strike, so, again, having a car let us take a trip to the countryside when other options weren’t available.
That was a long time ago, and several factors affected where we landed and departed, and when, and I’m not sure now that we’d do it the same way today. Paying the convenience fee of getting a car in Portugal and retuning it in Spain was worth it back then. Depends where you’re going in both countries, and what you want to see and do. More remote places make a car a good option. If your 2 weeks are centering around Madrid, Barcelona, and Lisbon, public transportation might be the way to go. And with cheap flights on vueling air or other airlines, what if you took the train to Barcelona from Madrid, then flew to Lisbon? Are you arriving in Madrid and heading home from Lisbon?