Northern Ireland got off to a dream start against Spain in Mallorca's Son Moix Stadium but couldn't fend off a subsequent onslaught and the evening heat as the hosts wrapped up their preparations for the forthcoming Euros.
Michael O'Neill made three changes to the side that defeated Scotland back in March, handing Caolan Boyd-Munce his senior debut with Jonny Evans, captain for the night, and Jamal Lewis also making their return.
And there was a real 'pinch me' moment for Boyd-Munce just over a minute into the game when he knocked forward a brilliantly executed free-kick for Dan Ballard to head unmarked into the top corner.
That goal, timed at just 66 seconds, visibly rocked the Spanish - and they almost fell further behind a few minutes after that when a sloppy ball by Rodri was pounced upon by Shea Charles then fumbled by keeper Unai Simon with Isaac Price being unfortunate to only find the side netting from an acute angle.
The 900-strong Northern Ireland contingent among 22,000 in the stands were in fine voice by this stage, but it was the turn of the home fans to have something to shout about on 12 minutes when 21-year-old Barcelona midfielder Pedri bagged the equaliser after picking the ball up some 25 yards from goal, composing himself and then firing low into the bottom corner beyond Bailey Peacock-Farrell.
Rejuvenated by this, La Roja went on to turn the screw somewhat as the first half progressed and moved in front just six minutes after that through skipper Alvaro Morata's header in off an upright from Jesus Navas' superbly delivered cross.
It was 3-1 just 10 minutes after that, with Pedri doubling his tally for the evening with an unmarked finish following Nico Williams' run and cutback from the left before, on 35 minutes, Paris Saint-Germain man Fabián Ruiz got in on the act with a tidy finish after Lamine Yamal had lifted the ball over the defence.
Northern Ireland almost ended the first half on a positive note, however, when Charles saw a stoppage time effort pushed away by the keeper but only as far as Price, although his follow-up from around 12 yards out unfortunately sailed over the top.
O'Neill made two changes at the break, with Corry Evans making his return to international action following a period out through injury, for Boyd-Munce, and Eoin Toal making way for Jordan Thompson.
As is often the case in these games the tempo dropped in the second half, but that didn't stop Spain from extending their advantage on the hour through substitute Mikel Oyarzabal when he touched the ball home from four yards after Yamal had dispossessed Price to send the cross over.
To their credit, Northern Ireland kept battling away and might well have pulled a goal back with just over a quarter-of-an-hour remaining. Dale Taylor, on for Jamie Reid a few minutes earlier, beat the offside trap and did well to tee Price up from 10 yards but Simon maintained his height to deal with the threat.
And not too long after that Ballard could have bagged his second of the evening, only for his finish to be just inches from finding the target after Thompson had delivered a set piece.
But, in the end, amid a raft of substitutions from both camps, there were to be no further goals as Spain got the Euro 2024 send-off they wanted while Northern Ireland now turn their attention to Andorra in Murcia on Tuesday night.
Spain: Unai Simon; Jesus Navas, Nacho, Robin Le Normand, Marc Cucurella; Pedri, Rodri, Fabian Ruiz; Lamine Yamal, Alvaro Morata, Nico Williams.
Substitutes: (used) Dani Carvajal, Mikel Merino, Joselu, Alex Grimaldo, Aymeric Laporte, Mikel Oyarzabal; (unused) Alex Remiro, David Raya, Dani Vivian, Dani Olmo, Ferran Torres, Alex Baena, Martin Zubimendi, Fermin Lopez, Ayoze Perez.
Northern Ireland: Bailey Peacock-Farrell; Dan Ballard, Jonny Evans, Eoin Toal; Trai Hume, Conor Bradley, Shea Charles, Caolan Boyd-Munce, Jamal Lewis; Jamie Reid, Isaac Price.
Substitutes: (used) Conor McMenamin, Dale Taylor, Corry Evans, Jordan Thompson, Ross McCausland, Brodie Spencer; (unused) Callum Marshall, Paul Smyth, Conor Hazard, Josh Magennis, Ciaron Brown, Pierce Charles, Ethan Galbraith, Aaron Donnelly.