The Primera Division champions dominated proceedings in the opening hour, and the away side were unable to get back into the game, with Jose Callejon starring
Cristiano Ronaldo opened the scoring early in the game after some good work from Karim Benzema before Jose Callejon doubled the hosts' lead around the half-hour mark.
Kaka then made it three after the break, only for Derk Boerrigter to peg one back after 60 minutes of play. Callejon restored Madrid's three-goal lead in the dying minutes of the game but it was purely academic, with Madrid already having secured second place in the group and Borussia Dortmund's victory over Manchester City meaning a defeat did not prevent Ajax from holding onto the consolation prize of a Europa League berth for finishign third.
Los Blancos started the match with attacking intentions and looked to have open the scoring after only seven minutes of play when Benzema tapped home from close range, but the referee disallowed the goal for offside. Shortly after, Madrid again threatened as Fabio Coentrao hit the post with a powerful shot from the left.
Madrid remained the better side of the two and eventually broke the deadlock in the 13th minute. Benzema escaped the offside trap after a fine pass from Luka Modric and then kept his calm to set up Ronaldo, who found the empty net with a confident shot from within the area.
Benzema continued to cause the Ajax defence all kinds of trouble with his intelligent movement and came close to adding his name to the score sheet after being set up by Kaka, but Kenneth Vermeer reacted alert and denied the Frenchman.
The Ajax goalkeeper was beaten in the 28th minute after a superb counterattack, though. Modric bullied Siem de Jong off the ball inside his own half before unleashing a magnificent pass over the top of the Ajax defence for Callejon, who superbly controlled the ball and calmly slotted home.
The Eredivisie champions, meanwhile, failed to really threaten at the other end, with Viktor Fischer's low shot after an solo run their only noteworthy opening during a one-sided first half.
Jose Mourinho's men immediately charged forward again after the re-start and were rewarded within five minutes when Kaka reminded everyone of his class. The Brazilian picked up a pass from Ronaldo inside the Ajax half, dribbled a few yards and then beat Vermeer with a measured shot from 20 yards out.
Ajax pegged one back at the hour mark after some poor goalkeeping from Antonio Adan. The 25-year-old failed to collect a cross from the left after rushing off his line and Boerrigter had no trouble finding the empty net.
Adan made amends for his error some five minutes later, though, when by saving Boerrigter's free kick from the edge of the box.
Danny Hoesen then should have helped Ajax further back in the game after shaking off Ricardo Carvalho, but the young striker wildly blasted the ball over the bar from a dangerous position.
The hosts would eventually restore their three-goal lead after some good work from Alvaro Morata, though. The youngster went by his direct opponent down the right and then sent in a perfect cross for Callejon, who doubled his tally for the night with a good header.
Madrid's easy win saw them finish second in their section with 11 points from six games. They resume domestic action with a trip to Valladolid on Saturday.
Ajax, meanwhile, qualified for the Europa League round of 32 thanks to results elsewhere. Their next match, though, is the Eredivise clash with Groningen in Amsterdam this weekend.