Spain started brightly and Morata had the chance to score from the spot, only to see his effort saved by Dubravka.
Lubomir Satka had played a high-risk ball across his defence that went straight to Sarabia. His shot pinged up from the crossbar and came down towards the Slovakia keeper on his line.
Facing his own goal Dubravka tried to push it over but inexplicably he patted into the back of his own net.
The Slovakian goalkeeper then turned into his own net to undo his good work before Laporte doubled the Spanish lead.
Pedri dinked it over the top for Gerard Moreno who hooked it back from the byline where Laporte climbed highest to double Spain’s lead with a looping header.
Jakob Hromada took a swing at the ball but missed and kicked Koke instead. Referee Bjorn Kuipers at first gave a free-kick to Slovakia but was advised to consult the pitch-side monitor and pointed to the spot.
Up stepped Morata but his kick lacked the power of Hromada’s swipe at Koke and was the perfect height for Dubravka to save.
It was Spain’s second missed penalty of the tournament and they would miss two more clear opportunities before the 20-minute mark.
Second-half goals from Sarabia, Ferran Torres and an own goal from Kucka did further damage for Spain, who run out 5-0 winners in Seville to send themselves through to the last-16 stages as they finish second in Group E.
With Spain’s next attack it was 3-0. Pedri, bruised from being kicked by Slovakia as much as he had been kicked by Sweden and Poland in previous games, was having his best match of the tournament so far and he swept the ball out to Jordi Alba whose cross was turned in from close range by Sarabia.
Ferran Torres who with a back-heel flick sent the ball past Dubravka with his first touch since coming on.
Pau Torres was another another late sub and he forced the fifth with Juraj Kucka turning the defender’s goalbound header over the line.
Spain qualify from Group E in second place, finishing behind Sweden who ran out 3-2 winners against Poland.
Enrique’s men face Croatia in their last-16 clash, which will take place in Copenhagen on Monday.
Slovakia, whose perfect start against Poland seems a long time ago now, are out despite finishing in third.
Tarkovic’s men will now have to wait until September for their next game, in which they travel to Slovenia in the World Cup qualifiers.