Spain scored five against a defensively disappointing Slovakia as the 2008 and 2012 champions avoided a shock and early elimination from the competition.
The Spaniards needed a win to qualify for the next stage and they should have taken the lead when Alvaro Morata stepped up in the 12th minute of the game only for his effort to be saved.
However, Spain would lead when Newcastle goalkeeper Martin Dubvraka fumbled the ball into his net in the 30th minute as Aymeric Laporte made it 2 on the dot of halftime.
The goals rained properly in the second half as Pablo Sarabia and Ferran Torres scored before another own goal from Juraj Kucka scored another own goal.
However, Spain was denied the top spot by Sweden as the Swedes beat Poland 3-2 to knock out Robert Lewandowski and his teammates despite scoring a brace on the night.
In Group F, it was drama all through as both games ended 2-2. Three penalties were scored in the game between France and Portugal.
Cristiano Ronaldo matched Ali Dei’s record for international goals as his brace of penalties took him tied with the Iranian on 109 goals.
Meanwhile, Karim Benzema also scored his first France goal in 5 years with a brace, first with a penalty on the stroke of halftime and the second goal in the second half.
The result meant that France won the group although Portugal will be grateful for a third-place finish which sees them into the next round.
That was made possible by Germany’s 2-2 draw with Hungary.
The Hungarians were in the lead as early as 11 minutes but Germany equalized in the 66th minute through Chelsea’s Kai Havertz while Hungary responded immediately but Leon Goretzka saved the Germans from an embarrassing elimination.
Now in the round of sixteen Germany will face England at Wembley while Belgium will play Portugal and France gets Switzerland.
2018 FIFA World Cup finalist Croatia will play Spain, Italy’s reward for hard work is Austria and Wales will play Denmark.
The Netherlands face the Czech Republic and Sweden will face Ukraine.