The Spaniards will now face World Cup hosts Russia in the second round after Portugal were held to a 1-1 draw by Iran in the night's other game.
Portugal will face Uruguay in Sochi on June 30 for a place in the quarter-finals after ending Iran's hopes of reaching the knockout phase for the first time.
After a breathless 3-3 draw with Portugal in their opening game, La Roja laboured to a 1-0 victory over Iran, and require at least a point in Kaliningrad against a Morocco side playing for pride to guarantee a last 16 berth.
Spain face a tough challenge to reach the FIFA World Cup 2018 knockout as the 2010 champions take on eliminated Morocco in their Group B clash at Kaliningrad Stadium on Monday.
Some players believe World Cup success is earned through exercise, diet and endless practice drills -- others are convinced it's a matter of wearing lucky underwear.
Cristiano Ronaldo said Portugal have room to improve at the World Cup after his early goal secured a 1-0 win over Morocco as the European champions edged closer to the last 16.
Ronaldo's sole goal in the Portugal vs Morocco match also made him the leading goal-scorer of the FIFA World Cup 2018 with four goals.
Cristiano Ronaldo followed up his opening game heroics at the World Cup with the only goal in a 1-0 win for Portugal against Morocco as the European champions edged closer to the last 16.
FIFA World Cup 2018, Portugal vs Morocco: Morocco are out of contention for the World Cup in Russia after Portugal beat the north African side 1-0 in their Group B match on Wednesday.
Cristiano Ronaldo will be in the limelight as Portugal seek first win in their World Cup Group B match vs Morocco.