Kids watch Alkmaar account for Ajax in cup
The original tie was abandoned on December 21 shortly before half-time after a fan invaded the pitch and attacked Alkmaar goalkeeper Esteban.
Esteban retaliated and was sent off but his red card was rescinded and Ajax were forced to replay the game in an empty stadium.
Ajax asked the Dutch football association (KNVB) to allow women and children to attend the match but the ruling body decided that only the latter would be permitted because of a national law of comparable treatment for men and women.
Roared on by some 20,000 vociferous youngsters, Siem de Jong put Ajax ahead after 10 minutes from a superb pass from Christian Eriksen.
Alkmaar hit back when Charlison Benschop set up Maarten Martens for the equaliser 14 minutes later and then playmaker Elm set up Benschop to fire the away side ahead.
A blunder from Esteban then allowed De Jong to equalise on 37 minutes, but Alkmaar scored the decisive goal 10 minutes into the second half when Elm converted a penalty after Toby Alderweireld handled.
Alkmaar will host amateurs GVVV Veenendaal in the quarter-finals.