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.
Real appeared to slacken off and could have punished more thoroughly than Derk Boerrigter's single consolation goal as he capitalised on a poor punch by Antonio Adan to slot home on the hour mark before Callejon rounded off the scoring two minutes from time.
Defeat for the Dutch champions though was compensated by news of Borussia Dortmund's victory over Manchester City which means Ajax qualify for the Europa League by finishing third in the group.
With Madrid already guaranteed to finish in second place, Jose Mourinho sent out a surprisingly 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.
Fabio Coentrao then hit the post at the end of another move involving Modric and Ronaldo, but the hosts had to wait just six more minutes before going in front.
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 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.
That change did not affect the nine-times winners' momentum going forward though and they 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.
Vermeer then kept the Dutch champions in the game before half-time with a fine save from Sami Khedira's long-range effort.
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.
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.