Mikel Merino came off the bench to score an injury-time winner for Spain as they knocked Portugal - and Cristiano Ronaldo - out of the World Cup in a heavyweight last-16 tie in Dallas.
Spain had failed to create clear-cut openings in a poor second half before Ferran Torres played in the Arsenal midfielder, who slotted low past goalkeeper Diogo Costa in the 91st minute.
The 1-0 result was a repeat of their meeting at the same stage in 2010 and sets up a quarter-final tie with either co-hosts United States or Belgium in Los Angeles on Friday, 10 July (20:00 BST).
Portugal's defeat also ends 41-year-old Ronaldo's World Cup career after the superstar confirmed this tournament would be his last.
Spain squandered a gilt-edged chance after just three minutes as Dani Olmo's pass helped Mikel Oyarzabal get behind the defence, but the Real Sociedad striker dragged his effort wide.
Costa then produced a double save to deny Spanish duo Lamine Yamal and Alex Baena in quick succession as La Roja probed for an opener, but it was Portugal who went closest next.
Spain were saved by the woodwork in the 41st minute as Nuno Mendes' venomous left-foot strike took a deflection off Pedro Porro and rattled the crossbar. However, the game remained goalless at the break.
Roberto Martinez's side continued to grow into the game after the break, though Ronaldo cut a frustrated figure up front in a second half that produced little in the way of action in the final third.
Bruno Fernandes hit the side-netting in the 76th minute, while at the other end Olmo's shot from inside the box was blocked by a brave Ruben Dias before the two Spain substitutes combined to produce the match-winning moment.


Immigration Service opens commanders' conference with renewed focus on synergy a...
Early Eurobond payment good for economy but Ghanaians may have to wait for relie...
Court Confirms Akofena as Kantanka Successor as Will Settles Leadership Dispute
Gov’t Secures $21m EU Grant to Fix Faulty Tema–Mpakadan Rail Signalling After Au...
Railway Row Erupts: Ex‑MP, GRDA Boss Clash Over ‘Outdated’ Tema–Mpakadan Locomot...
EOCO, CID Raise Red Flag as Deadly ‘Model Q’ Crime Network Spreads Across West A...
President Urges Ghanaians to "Clean Ghana, Save Lives"
Nearly 50,000 students receive over GH¢187 million in loans — Student Loan Trust...
Recruitment process for 36th batch of Medical Officers and Dentists to begin Jul...
100% of cabbage samples from Agbogbloshie, Madina Markets fail safety test — Sta...