The Croats came from two-goals down with five minutes of normal time remaining as Mislav Orsic and Mario Pasalic stunned La Roja to somehow force extra-time.
But there was to be no fairytale as a stunning Alvaro Morata goal and another from Mikel Oyarzabal ensured a Spanish victory.
It looked like Chelsea captain Cesar Azpilicueta and Man City's Ferran Torres completed a turnaround for Spain earlier, in a roller-coaster match which saw both teams come from behind.
Spain goalkeeper Unai Simon failed to control a simple back pass from Pedri and watched in horror as the ball trickled into his own net in the 20th minute.
La Roja overcame the mistake and made their dominance pay soon after, with Serabia equalising after waves of pressure before half-time.
Azpilicueta rounded off a fine team move after the break, heading home from a Torres cross to net his first ever international goal and become Spain's oldest ever Euros scorer at 31 years and 304 days.
Then Torres got a goal of his own, capitalising on some sloppy Croatia defending and seemingly putting the game to bed.
But the game was far from finished as the Croats, despite hardly having a shot in the game, set up a tense finish when Mislav Orsic pulled one back with the help of goal-line technology after a scramble in the Spain box.
With such little time remaining, Spain were still strong favourites, until Mario Pasalic struck in the second minute of injury time.
The Atalanta star, who spent six years on the books at Chelsea but never made an appearance, proved his worth on the biggest stage imaginable.
Unfortunately, their heroics would ultimately be in vain as Spain showed their class in extra-time.
Morata silenced his critics with an incredible left-footed volley, before Oyarzabal doubled the lead.
However, speaking on commentary for talkSPORT, former England winger Trevor Sinclair said: "I still don't want to say it's over!"
In the end, it was, but Croatia leave the tournament with their heads held high, having gifted the neutral the best match of Euro 2020 so far.
As for Spain, becoming the first team in history to score five in two consecutive Euros matches is hardly the mark of this boring team everyone was banging on about.