After Stephan El Shaarawy had given Milan a 1-0 lead in the 47th minute, the France defender put the game away with a strike which had shades of Zlatan Ibrahimovic's brilliant bicycle kick against England last week.
In the 71st minute, Mexes received a free kick on the edge of the box but found himself with his back to goal. In a seemingly hopeless situation from 20 meters out, he chested the ball upward before propelling himself off the ground and launching an overhead kick that dipped over goalkeeper Silvio Proto's head and into the far corner.
If El Shaarawy's opener could not match the beauty of Mexes's goal, it did show the class of the young Italy international. He deftly controlled a long cross with his left foot to set up right-footed curling shot that gave Proto no chance.
The consolation goal of Tom De Sutter in the 77th had little impact. El Shaarawy added an assist to his goal when he set up Pato for a third in injury time.
With one game remaining, Malaga has 11 points, three more than Milan. Anderlecht and Zenit St. Petersburg both have four points and are competing for a Europa League berth.
In Brussels, though, it showed off a newfound confidence — and an emerging star in El Shaarawy. The 20-year-old forward's fine strike brought up his 15th goal of the season in all competitions.
Milan was without captain Massimo Ambrosini, who had not recovered from the flu.