Introduced at half-time with her side trailing to Caroline Weir's early opener for the hosts, 25-year-old Macario showed composure to convert twice from 12 yards and send Chelsea six points clear of their opponents on the last matchday of Group B.
Weir's dinked finish in the seventh minute had Real going through to the quarter-finals as group winners on overall goal difference.
If the match had finished 1-0 to Real, both they and Chelsea would have won their home match against the other by a one-goal margin -- the Blues beat the Spaniards 3-2 in October -- and with the aggregate scored tied at 3-3, the pool would have been decided on goal difference across the group stage as a whole.
But in the end, it did not come down to such narrow margins as Macario levelled six minutes after coming onto the pitch and then completed the comeback on 56 minutes.
Real captain Olga Carmona -- the player who scored the winner in the 2023 World Cup final for Spain against England -- was the player who offered the English champions their way back into the tie.
She felled Macario to concede the first spot-kick, before later being penalised for a handball in the box.
The result means Chelsea have now won their last nine group games in the Champions League, going back to last season.
In the pool's other match, Dutch side Twente condemned Celtic to a sixth defeat in six outings as they won 3-0 in Enschede.
Later, eight-time champions Lyon take on two-time winners Wolfsburg with the French side already assured of top spot in Group A.
© 2024 AFP