Ferland Mendy scored his first European goal four minutes from time as Real Madrid beat 10-man Atalanta 1-0 in the first leg of their UEFA Champions League round-of-16 tie.
A well-organised Atalanta looked set to hold on for a draw in a drab encounter at Gewiss Stadium on Thursday (AEDT) despite Remo Freuler's red card for a professional foul on Mendy after 17 minutes.
Mendy's fine finish late on made it advantage to the injury-hit La Liga champions ahead of the second leg at the Santiago Bernabeu on March 17.
Los Blancos had looked devoid of ideas and could only muster four shots on target, but Mendy stunned the Serie A side in the closing stages.
Atalanta suffered a massive blow when midfielder Freuler bundled a marauding Mendy over just outside the penalty area and referee Tobias Stieler whipped out a red card.
Casemiro was also ruled out of the second leg when he was cautioned for a foul on Duvan Zapata, who was replaced by Mario Pasalic on the half-hour mark after sustaining a knee injury.
Pierluigi Gollini reacted sharply to keep out Casemiro's close-range header after Toni Kroos whipped in an inviting free-kick late in a cagey first half, which saw Gian Piero Gasperini employ Luis Muriel as a lone striker as he made a tactical switch after Freuler's dismissal.
Luka Modric almost opened the scoring just after the break with a deflected shot that trickled just wide of the far post before great defending from Robin Gosens prevented Vinicius Junior from slotting in from close range.
Los Blancos dominated possession, but looked short of ideas and playmaker Modric blasted over the crossbar with Atalanta looking relatively comfortable.
Casemiro was fortunate not to be shown a second yellow card for simulation before Mendy won it with a superb measured right-footed finish from around 20 yards out.