Spain beat Portugal 1-0 in Dallas on Monday as substitute Mikel Merino scored in stoppage time to send the European champions into the World Cup quarter-finals.
Ferran Torres slipped the ball through to Merino in the first minute of injury time, and the Arsenal midfielder finished the chance to settle a cagey last-16 tie.
The result ended Cristiano Ronaldo’s final World Cup appearance. The 41-year-old Portugal captain had confirmed before the match that this tournament would be his last.
Spain will face either the United States or Belgium on Friday in Los Angeles.
The match drew 70,649 fans at the air-conditioned home of the Dallas Cowboys but produced few clear chances for either side.
Spain almost led inside 10 minutes when Dani Olmo found Mikel Oyarzabal, but the forward dragged his effort wide with only Diogo Costa to beat.
Ronaldo tested Unai Simon from a tight angle in the first half. Spain then pushed forward as Lamine Yamal and Alex Baena forced saves from Costa.
Read: Balogun Red Card Ban Lifted Before Belgium Clash
Portugal came closest before halftime when Pedro Porro headed Nuno Mendes’ shot onto his own crossbar.
Spain have still not conceded a goal at the tournament. Portugal went out after entering the match unbeaten.