Spain coach Fernando Hierro said Monday his side must defend better after a last-ditch VAR-assisted equaliser earned them a 2-2 draw with Morocco and set up a second round clash with hosts Russia.

The injury-time goal from substitute Iago Aspas capped a dramatic finale to a Group B that Spain ended up topping after Iran levelled late against Portugal to draw 1-1 in Saransk.

But Hierro, himself a former centre back, said the team needed to work on its defence following a group stage that saw the 2010 winners ship five goals in three games.

“Obviously we can improve. Five goals in three matches is not the way forward. The players are professional, they understand what the situation is,” he told reporters.

Morocco took the lead in the 14th minute when Khalid Boutaib took advantage of a horrible mix-up between Sergio Ramos and Andres Iniesta to race through and slide the ball calmly through David De Gea’s legs.

Things nearly got even worse for La Roja, when Boutaib missed a golden chance put Morocco ahead for a second time after Isco had pulled Spain level.

The striker’s low one-on-one shot was saved by De Gea after both Ramos and Gerard Pique were caught napping with a quick throw in.

Hierro refused to single players out for criticism but promised his side would work collectively to shore things up at the back.

“You cannot hold individuals responsible for letting goals in. Everyone needs to defend as a team and that’s our style,” he said.

Isco’s goal was straight out of Spain’s World Cup winning playbook of 2010, with Diego Costa setting Iniesta free in the penalty area after some crisp one-touch passing.

The Barcelona man cut back with the outside of his right boot to Isco, who fired into the roof of Monir El-Kajoui’s net from six yards.

“We’re happy we’ve finished top of the group, that’s what we wanted. Maybe we wanted to feel differently after the match but we’re happy to go on. Now we are facing the moment of truth,” Isco said.

“I have complete faith in this team.”

‘Continue the adventure’

Morocco coach Herve Renard said before the game his team, the first to be eliminated this tournament, had been victim to “total injustice” in back-to-back 1-0 losses.

“We would have loved to beat Spain,” Renard said at full time. “We should be proud of what we’ve done, of the team and proud of the Moroccan public too.”

After a bright first half, Morocco sat back in the second period and invited Spain to try to break them down.

When they regained possession they broke with pace and purpose, and nearly took the lead after 55 minutes when Noureddine Amrabat’s right-foot scorcher from distance cannoned off the crossbar.

Isco’s header on the hour mark forced a goal-line clearance from Ghanem Saiss, chosen by Renard to start over captain Mehdi Benatia.

Morocco were aggrieved not to be awarded a penalty 10 minutes from time when the ball struck Pique’s fist in the area.

They weren’t complaining minutes later, however, when substitute Youssef En-Nesyri headed home the corner that followed to the rapture of the Moroccan supporters.

As the 90 minutes wound down, Aspas’ clever flick from a corner was initially adjudged by the assistant referee to have been offside.

But after intervention from VAR it was given as a goal, much to the consternation of the Moroccan players and substitutes, some of whom stormed the pitch in protest.

Spain now play hosts Russia in Moscow’s Luzhniki Stadium on Sunday and Hierro said his team would be ready.

“We know it’s going to be tough with their fans at home but we do want to continue the adventure,” he said.