The Blues had been looking to maintain their 100 per cent record in Group A to book their place in the last eight.
However, after Sam Kerr had twice struck the woodwork, Madrid went in front when Scotland midfielder Caroline Weir scored after capitalising on a mistake from Chelsea keeper Ann-Katrin Berger.
Chelsea equalised early in the second half when Guro Reiten’s penalty went in off Madrid keeper Misa Rodriguez for an own goal, and Kerr saw her late effort tipped over.
The result leaves Chelsea three points clear of Paris St Germain at the top of Group A, the French side having beaten Vllaznia 4-0 earlier on Thursday, and five points above third-placed Madrid, with two games left.
Chelsea went close to an early goal when Australian striker Kerr crashed a shot against the crossbar from close range after a corner.
Madrid threatened when left-back Olga Carmona sent over a dangerous cross and Chelsea captain Magdalena Eriksson was alert to head the ball clear.
Athenea Del Castillo then got away down the right wing, but her ball into the area was nodded away by Kadeisha Buchanan before Carmona drilled a 25-yard effort wide.
Kerr struck the woodwork again on the half-hour when her low shot came back off the post after being played in to the left side of the Madrid penalty area by Lauren James.
A mistake by Berger gifted Madrid the opening goal in the 36th minute when her clearance fell straight to Weir, who slotted a low shot into the net from the edge of the box.
Blues boss Emma Hayes made a double change for the second half, with Fran Kirby and Niamh Charles replacing Jessie Fleming and Eriksson.
Chelsea were awarded a penalty in the 56th minute when Ivana Andres brought down Reiten.
The Norwegian got up to take the spot kick, which was turned onto the post by Rodriguez but then bounced back off the keeper and into the net.
Chelsea pushed for a second goal, with James firing over the bar as she met a cross from Charles at the back post.
The home side, though, remained dangerous on the break and, with 10 minutes left, Berger redeemed herself to make a fine block when Carmona burst into the area.
Kerr then almost snatched a dramatic late winner when latching onto a sweeping pass from Reiten, but Rodriguez produced a brilliant save to tip the ball over the bar.
Additional reporting from PA