Striker David Villa scuffed a shot which deflected off Diego Godin and -- apparently going wide of the goal -- then hit Gabi before bobbling into Thibaut Courtois' net.
Di Maria was on hand again in the second half latching onto to a pass from Karim Benzema in the 62nd minute before firing home the winner past Belgian goalkeeper Thibaut Courtois.