Morocco became the only fourth African country to make it to the quarter-finals of the World Cup after beating Spain on penalties on Tuesday at the Education City Stadium in Al Rayyan.
The Atlas Lions were so solid in defence as they were able to contain the Spanish attacking threats for 120 minutes of football after extra time.
Morocco came close to getting the opening goal two minutes to the interval, but an effort from Nayef Aguerd went a whisker after heading a ball from Soufiane Boufal.
The second half of the match was highly tactical as both sides failed to create openings in opposite defence to get a breakthrough.
Walid Cheddira wasted a glorious chance in the early stages of the first period of the extra time as goalkeeper Unai Simon made a superb save to deny him.
Spain were so close to scoring the match-winner in stoppage time of the extra time, but a shot from Pablo Sarabia inside box struck the woodwork before going out of play.
Spain missed all three kicks of their penalty shootouts, which had Sarabia, Carlos Soler and captain Sergio Busquets all missing their kicks.
Madrid-born Achaf Hakimi stepped up, and converted the final kick to send the Moroccans through to the quarter-finals of the tournament after winning 3-0 in the shootouts.
The Atlas Lions will face the winner between Portugal and Switzerland on Saturday.