Substitute Rafa Mir hit a hat-trick as Spain finally saw off Ivory Coast 5-2 in extra time in the Tokyo Olympics men's football on Saturday to set up a semi-final with hosts Japan.
Mir hits hat-trick to send Spain into Olympic semi with Japan
Ivory Coast's goalkeeper Eliezer Ira Tape conceded five times against Spain
Brazil defeated Egypt 1-0 thanks to a first-half strike by Matheus Cunha and will play Mexico in the other last-four clash. Both matches are on Tuesday.
The Spaniards are one of the gold medal favourites after naming a strong squad featuring six members of the team that reached the Euro 2020 semi-finals.
But they suffered a major fright before reaching the last four at the pandemic-delayed Games, even if the scoreline suggested otherwise.
Spain were just minutes from going out when forward Max Gradel's deflected strike made it 2-1 to the Ivorians in the 91st minute of normal time.
But the Spaniards responded almost immediately, Wolves forward Mir lashing in from close range to force extra time, just a minute after coming on.
Manchester United defender Eric Bailly then conceded a penalty for handball after the intervention of VAR, with Mikel Oyarzabal stroking the ball in for a 3-2 Spain lead in the 98th minute.
Mir struck twice in the dying minutes to put extra gloss on the scoreline and claim the match ball for himself.
Japan's quarter-final with New Zealand was a far tighter affair with the score deadlocked at 0-0 after 120 cagey minutes. New Zealand had only two shots on target all match.
The hosts kept their nerve in the penalty shootout and the Kiwis missed twice from the spot, sending Japan through 4-2 on penalties.
Rampant Mexico stormed past South Korea 6-3 in a quarter-final goalfest to set up a date with Brazil, the reigning Olympic champions.
Henry Martin and Sebastian Cordova both scored twice for the Mexicans.
Eyewitness? Submit your stories now via social or: