Morocco were moments away from one of the most historic results in their history after a superb display in Kaliningrad, only for Iago Aspas's late equaliser - which had been initially ruled out for offside - to deny them a 2-1 victory over Spain.
The win may have been lost at the last, but this was an outstanding Morocco display in which the qualities that took them to the brink of a result against Portugal in their second group game again saw them hold one of Europe's giants at bay.
Despite ceding 75 percent of the possession to Spain, Morocco defended resolutely, and limited La Roja to only five shots on target, with Karim El Ahmadi an excellent screen for the back four.
Their pressing game remained effective, although a little more refinement on the counter-attack was required.
Once again, Morocco's lack of a quality centre-forward came back to bite them.
Khalid Boutaib may have opened the scoring with a composed finish, but he later missed a one-on-one and was a clumsy presence who offered little danger in the channels.
Manager rating (out of 10):
9 - Herve Renard made the bold move to drop Medhi Benatia for his match, although the influential Juventus defender wasn't missed as the Atlas Lions delivered an exceptional defensive display.
Again, the intense pressing and transitions that troubled Portugal were again evident in Kaliningrad, even if Spain enjoyed much more of the ball, and Renard must take some credit for the expertly drilled defence.
His substitutions made the difference as well, as Fajr set up En Nesyri for Morocco's second and take them to the brink of a famous triumph.
Player ratings (1-10, with 10 the best. Players introduced after 70 minutes get no rating):
GK Munir, 7 -- A competent display by the Spain-based goalkeeper, even if he arguably went down a little too quickly for Spain's first goal.
DF Achraf Hakimi, 7 -- Completed his encouraging tournament showing with a confident display; he was energetic, closed town effectively, tackled strongly and demonstrated a great touch.
DF Romain Saiss, 8 -- Restored to the starting XI at the expense of Benatia and repaid Renard's faith emphatically.
He made an excellent interception on 37 minutes to deny a goalscoring opportunity, and was a key asset defensively on set pieces
The defender also blocked Isco's header on the line just after the hour mark, as Spain's pressure increased, and was composed until the end.
DF Manuel da Costa, 7 -- Was booked on the half-hour mark, but was generally solid, and made an excellent block in the 23rd minute.
DF Nabil Dirar, 8 -- A rounded display; he had already been exposed before Spain's goal, when he wasn't tight and then found himself out of position.
He did later make a fine interception to deny Andres Iniesta as Spain continued to attack his flank, and covered well when Sergio Ramos sought to find La Roja's attackers with a long ball.
Going forward, his chemistry with Nordin Amrabat caught the eye, and one wonders whether Renard will regret having dropped him for the defeat by Iran.
MF Karim El Ahmadi, 8 -- An effective display by the midfield general, even though he was booked on 22 minutes. He marshalled the middle of the park with authority, often dropping back into defence or doubling up when required.
He read the game superbly, as ever, and screened the back line throughout.
MF Mbark Boussoufa, 7 -- A nimble, lively presence as usual, he took authority in possession and constantly sought to speed up play and transition from defence to attack.
MF Nordin Amrabat, 8 -- Was involved in an early flashpoint, and was later booked before the half hour mark after catching Sergio Ramos.
Grew into the game as things opened up in the second half, and rattled the woodwork in the 54th minute to lift the crowd.
MF Younes Belhanda, 6 -- Not as influential as he had been against Portugal, Belhanda too often slowed the game down for Morocco when he had options to release, and lost the ball on several occasions.
He appeared to be playing more conservatively than he had previously.
MF Hakim Ziyech, 6 -- He enjoyed a few inventive moments and created one goalscoring opportunity, but his finishing was wayward.
FW Khalid Boutaib, 7 -- A questionable choice by Renard after his toil against Portugal, but he responded to his selection by capitalising on a Sergio Ramos error before keeping his composure to slot a left-footed finish past David De Gea for the opener.
That composure deserted him in the 24th minute when, after breaking through again, and he took a touch too many.
He was often clumsy in the build-up, giving away possession when dropping deep, but relished his battle with Ramos and Pique.
MF Faycal Fajr, 8 -- A longtime Renard favourite due to his set-piece delivery and crossing ability, and almost served up the biggest win of the Moroccan's tenure here with an excellent delivery for En Nesyri's goal
FW Youssef En Nesyri, 7 -- A physical threat from his introduction, and nearly wrote his name into the history books by burying an excellent header beyond De Gea from Fajr's cross.
FW Aziz Bouhaddouz, N/R