They moved 2-1 ahead on 19 minutes when Jesus Navas produced a brilliant cross from the right for Morata to nod home via the post, and doubled their lead 10 minutes later when the dangerous Nico Williams powered clear down the opposite wing and pulled back for Pedri.
Five minutes later, Yamal twisted and turned before measuring a brilliant ball into the Northern Ireland box for Ruiz to finish off.
While Spain were in complete control, Northern Ireland should have cut the deficit before the break with Simon only able to parry Shea Charles' effort from the edge of the box before Isaac Price blazed over when the rebound was poked back his way by Jamie Reid.
A series of substitutions saw the game lose its momentum and it would take until the hour mark for Spain to add to their lead in the second half.
Northern Ireland, though, felt they should have been awarded a free-kick before the ball found the net when Price was caught in possession by Yamal.
The officials saw nothing wrong with the challenge and Yamal's pull back gave substitute Oyarzabal a tap-in at the front post to follow on from his hat-trick against Andorra earlier in the week.
With their Euro 2024 opener coming closer into view, it was perhaps understandable that the intensity shown by Spain in the first half was largely lacking in the second, with Bailey Peacock-Farrell finding himself with less to do as the game wore on.
Indeed, it was Northern Ireland who could have scored next when another chance fell to Price, this time found by Dale Taylor, but the Standard Liege man was this time denied by Simon.
Later Ballard just could not find the right connection on another threatening set-piece, but it was Joselu who had the last real chance of the game only to fire over the bar from ten yards out.
While Spain head to the Euros among the favourites, Northern Ireland's players will have another opportunity to finish their own season on a high when facing Andorra in Murcia on Tuesday night.