The Frenchman chested up the ball on the edge of the area and sent a dipping bicycle kick into the far corner of the net to stun the Belgians and prompt immediate comparisons to Ibrahimovic's goal for Sweden again England this month.
Milan opened the scoring when Stephan El Shaarawy, the leading scorer in Italy's Serie A, found himself alone in front of goal in the 47th minute after a cross into the box by Mattia De Sciglio and calmly clipped the ball home.
Mexes, hardly known for his goals, added the second in the 71st minute with his piece of magic shortly after the Belgian league leaders were reduced to 10 men when Bram Nuytinck was sent off for a foul on Alexandre Pato.
Tom De Sutter pulled one back for the hosts in the 77th minute but Anderlecht's hopes of remaining in the Champions League were over when Pato sealed their fate by converting a pass from El Shaarawy in injury time.
"I don't remember what expression I made," Milan coach Massimiliano Allegri told Mediaset TV in reference to Mexes' goal.
"Philippe scored a great goal but honestly I thought the ball went over."
Seven-times European Cup winners Milan, struggling down in 12th in Serie A, qualify with eight points in second spot to ease the pressure on Allegri after top names including Ibrahimovic were sold to balance the books.
Anderlecht, who held Milan to a goalless draw at the San Siro during the first Group C encounter, had dominated the first half with Milan Jovanovic and Dennis Praet failing to convert attempts on goal.
Malaga secured top spot in the group by drawing 2-2 at Zenit St Petersburg, who will now battle it out with Anderlecht for third spot and a Europa League berth with both sides on four points.
The Belgians travel to Malaga for their final group game on December 4.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.