The match took place in Kaliningrad on Tuesday morning (AEST) and Morocco saw victory slip through their fingers as they led twice, only for Spain to equalize on both occasions.

The 2010 World Cup winners salvaged a last gasp equalizer in stoppage time and topped Group B after Portugal were held to a 1-1 draw by Iran.

"Of course we wanted to win today. We've done everything we could today. It was a good experience for us" Renard  said.

"Portugal and Spain are the two best teams in the world but we presented our team at the World Cup very well. We're leaving Russia with our heads held high."

The head coach added that the players had learned a lot during the group stage and their fans should be proud of them.

"We learned that we can play at a very high level. You should be proud of all our players. This is something that I will always remember," Renard said.

Morocco picked up only one point from their three matches at the tournament, losing to Iran and Portugal 1-0 before drawing with Spain.

The 2018 FIFA World Cup kicked off on June 14 and will continue until July 15, with the matches being played in 11 cities across Russia.