Spain will be favourites to beat Morocco in the World Cup last 16 on Tuesday but the teams' experiences in the group phase were a reminder of the unpredictability of tournament football.
Spain, who humbled Costa Rica 7-0 in their opening game, finished second in Group E behind Japan while Morocco defied the odds to win Group F ahead of Croatia and Belgium.
The Spanish, world champions in 2010, lost their last group match to Japan and face a difficult test from a Moroccan side growing in confidence under coach Walid Regragui.
After Morocco had beaten Canada 2-1 to reach the last 16 for only the second time and first since 1986, FIFA posted a photo of Regragui holding an avocado with a soccer ball inside it and pointing his finger at his head in a defiant message to his critics.
The goal they conceded to Canada was their first in six matches under Regragui and during the victory celebrations, the players gathered around the coach touching his head.
"They like to hit me on the head. Perhaps this will be lucky omen for them," Regragui told reporters.
Morocco are happy to sit back and look to punish opponents on the counter-attack using the speed and skill of Hakim Ziyech who returned to the national team when Regragui took over after a dispute with former coach Vahid Halilhodzic.
The Atlas Lions started the finals with a goalless draw against Croatia before a convincing 2-0 victory over Belgium, a win achieved despite the absence of goalkeeper Yassine Bounou who pulled out due to illness just before kickoff.
Spain drew 1-1 with Germany following their rout of Costa Rica and after the loss to Japan coach Luis Enrique was critical of his team.
"I am not happy at all. Yes, we have qualified, I would have liked to be on top of winning this game. This was impossible because in five minutes, Japan scored two goals ... we were out, we were dismantled," he said.
Luis Enrique's Tiki-Taka style of play relies on the Barcelona midfield trio of Sergio Busquets, Pedri and Gavi.
In the first half against Costa Rica, Spain's 537 successful passes set a World Cup record but they will need to show more cutting edge to stay on course for a second world title.