MOSCOWinfo-icon- Portugalinfo-icon are into the knockout stages of the Worldinfo-icon Cup, but Iraninfo-icon came incredibly close to causing a stunning upset on a night of high drama in Saransk.

During the course of a wild evening in the final round of Group B games, Portugal were top of the group, then second and even came within a whisker of being eliminated altogether, surviving a huge scare to book their place in the last 16.

Iran had proved stubborn opponents but were eventually undone in the final minute of the first half when Ricardo Quaresma's sublime outside-of-the-boot effort swerved inside the post from distance, and had appeared to set Portugal on the path to victory.

Iran almost completed a sensational turnaround in stoppage time in the Mordovia Arena, but Mehid Taremi could only find the side netting, and coach Carlos Queirozinfo-icon felt, over the 90 minutes, Iran deserved to earn a victory that would have taken them to the last 16 for the first time in their historyinfo-icon.

Queiroz was furious with the decision to only show Cristiano Ronaldo a yellow card, even after consulting VAR, for a flailing elbow on Morteza Pouraliganji.

Ronaldo should have been sent off for an elbow in the face of Morteza, and Iran should have been awarded at least one more penalty.

Queiroz was incensed by an incident in the 80th minute when Ronaldo sent Murtaza to the ground. The referee consulted the VAR to see if it was a red card, then decided to hand the Portuguese captain a yellow.

"The reality is you stop the game for VAR and there is an elbow," Queiroz said. "An elbow is a red card in the rules. The rules don't say if it is Messi or Ronaldo. 

"It is a red card. The question, for me, is not about the referees. It is about the attitude and the bravery and the character. The decisions must be clear for everybody, for the people. In my opinion, Mr Infantino and Fifa, VAR is not going well. That is the reality.

"I am not in a good mood, as you can see. There could have been at least one more penalty against Portugal, at least one. Five guys sitting upstairs and they don't see an elbow. Give me a break."

Earlier after a lovely strike by Ricardo Quaresma put Portugal ahead on the stroke of halftime, Iran fought back and a stoppage-time penalty by Karim Ansarifard secured a draw. But with Spaininfo-icon and Morocco drawing 2-2 in the other Group B match, it was not enough.

Victory over Portugal in their final Group B match would have seen Iran through to the knockout stage. The underdogs played with huge heart in a drama-filled match.

"Only one winner could come out in this game and it should have been Iran," Queiroz told reporters. "We deserved to win. I am a bad loser, I am proud but frustrated."

Queiroz, who has said he will quit his post after six years at the helm following this tournament, paid fulsome tribute to his players, staff and to the Iranian fans who have turned up in Russiainfo-icon in huge numbers.

"We have learnt a lot here, we have gained respect from people," he said. "The Iranian players are very courageous. I try to get the spirit of Portuguese bull-fighters from them. How they go into the ring and dominate the animal with courage." 

"There are few people that are running the show behind the scenes," he said. "The truth must be respected and we need to know who is refereeing the games."

Queiroz has a reputation for speaking his mind -- at length -- and did so when he was asked about throwing his jacket down on the field during the game. The outburst occurred after Ronaldo was awarded a penalty kick for a collision with Iran's Saeid Ezatolahi in the area.

As it happened, Iran goalkeeper Ali Beiranvand saved Ronaldo's effort.

"The temperature in my body, , it comes from 46 (Celsius) to 250, so you understand why I need to take the jacket off," he said. "The question for me is not about the refs. It's about the attitude, and the decisions must be clear for everybody, for the people. Everybody agrees that VAR is not going well. There are a lot of complaints.

"I think Iran, without any doubt in my opinion, with the discipline, with the attitude, with the way we controlled the game, if there was some justice in footballinfo-icon - which doesn't exist - only one winner would have come out in this game, and that winner should be Iran," Queiroz added.

Spain 2-2 Morocco

Spain snatched a 2-2 draw against Morocco on Monday to qualify for the World Cup last 16 as Group B winners after pipping Portugal to the post on goals scored.

Morocco striker Khalid Boutaib gave the north African side a shock early lead but Isco levelled, blasting high into the net after a neat neat layoff from Andres Iniesta.

Morocco made a game of it despite having their fate already sealed and struck again in the 81st minute when substitute Youssef En-Nesyri rose highest to put Spain on the brink of a first defeat since Euro 2016.

However, Iago Aspas grabbed a stoppage-time equalizer after consultation from the video assistant referee (VAR) determined he was not offside.