Spain worked hard to secure a 2-2 draw against Morocco, and Cristiano Ronaldo survived red card as Portugal saw out a 1-1 draw against a spirited Iran side.
Portugal vs Iran game was a tight match with few chances opening up and both teams having to try their luck from range.
Just when it seemed the game would be goalless at the break, Ricardo Quaresma produced a moment of magic to break the deadlock.
A brilliant curling shot with the outside of his boot found the far top corner to put Portugal ahead in style.
Portugal had the chance to double their lead in the second half, but Cristiano Ronaldo saw his penalty saved by Iran goalkeeper Ali Beiranvand.
Meanwhile, Spain who had struggled to beat Iran 1-0 in their previous game, fell behind when Khalid Boutaib ran clear of their defense to finish past David de Gea after 14 minutes.
The 2010 world champions equalized five minutes later when Isco finished smartly after fine work from Andrés Iniesta, but they failed to take a number of chances to increase their lead.
And they were made to pay for their profligacy with nine minutes remaining when Youssef En-Nesyri headed home powerfully from a corner.
However Aspas flicked in with a superb finish to equalize, once VAR had been consulted, and Iran’s late penalty in the other game in the group meant Spain went back to the top and will take on the hosts in Moscow’s Luzhniki Stadium on Sunday.
Portugal and Spain have now advanced into the round of 16 from the highly competitive Group.