City's Bernardo Silva and Mateo Kovacic both misfired in the shootout to put Madrid in the driving seat
In the first international game with fans in attendance in Spain since the onset of the COVID-19 pandemic, Jose Fonte thought he had opened the scoring for the visitors after 23 minutes, however, his looping header was ruled out for a foul on Pau Torres.
Portugal keeper Rui Patricio denied Ferran Torres from close range with two minutes remaining, before Alvaro Morata hit the bar in stoppage time as the hosts pushed for a late winner to no avail.
Spain face Lithuania in their final warm-up fixture on Tuesday before the Euros kick off next Friday.
Portugal host Israel on Wednesday before they start the defence of their Euro title.