Goals from Cristiano Ronaldo and Jose Maria Callejon had the home side 2-0 up within half an hour as they completely dominated the first period and Kaka made it three just after the interval with a sumptuous strike from 20 yards.
Derk Boerrigter's single consolation goal saw him capitalise on a poor punch by Antonio Adan by slotting home on the hour mark, before Callejon rounded off the scoring two minutes from time.
Defeat for the Dutch champions was compensated by news of Borussia Dortmund's victory over Manchester City which meant that Ajax qualified for the UEFA Europa League by finishing third in the group.
Surprisingly strong Los Blancos lineup
With Madrid already guaranteed to finish in second place, Jose Mourinho sent out a strong side and was rewarded as the pace and skill of Ronaldo, Karim Benzema, Luka Modric and Kaka proved far too much for the visitors to handle.
Benzema thought he had opened the scoring when he poked home from close range after just seven minutes but he was adjudged to have wandered offside from Ronaldo's cross.
Modric won the ball bravely in midfield before releasing Benzema with a ball over the top and the Frenchman unselfishly laid the ball across for Ronaldo to sweep home his sixth UEFA Champions League goal of the season.
Kenneth Vermeer produced a fine save moments later to deny Benzema the goal his performance deserved and Real suffered a potentially significant setback when Coentrao hobbled off with a hamstring injury to be replaced by Pepe.
The nine-times winners doubled their lead in style after 28 minutes as another fine pass from Modric split the Ajax defence and Callejon controlled the ball brilliantly before dispatching it beyond Vermeer and in off the inside of the post.
Captain Kaka in on the act
But there was nothing he could do to prevent Real going 3-0 up four minutes after the break as Kaka, captaining the side for the evening, broke forward and curled a wonderful effort into the top left corner of the net.
Mourinho's men then seemed to take their foot of the pedal though and after a brief spell of pressure Ajax pulled a goal back.
Antonio Adan came a long way for a routine cross but only succeeded in punching the ball straight to Boerrigter who side-footed the ball into the unguarded net. Boerrigter then had a free-kick well held by Adan and Daniel Hoessen blazed over when clean through on Real's stand-in keeper.
Ajax could not find the second goal they needed and Callejon showed the difference between the sides as he headed home Alvaro Morata's cross two minutes from the end to register his second of the evening.