Real Madrid saved their blushes with a late winner, after a shocking Champions League display in Italy, despite playing against 10 men for more than 70 minutes.
Ferland Mendy scored his first ever European goal, with a curling right foot shot from outside the box four minutes from time, to give the Spanish side the edge in the tie.
And that added insult to injury, because it was Mendy who won the foul which saw Atalanta defender Remo Freuler dismissed after just 17 minutes.
It offers manager Zinedine Zidane some breathing space, with future is again in doubt at the Bernabeu after a string of poor performances.
Atalanta can feel mightily aggrieved at the red card which reduced them to a heroic defensive effort for more than 70 minutes of what proved a turgid contest.
Mendy darted towards the box on the left, and Freuler did little more than brush against the Real wide player, who flung himself to the turf.
It was barely a foul, and some debate whether the Swiss defender denied a clear goalscoring opportunity, but German referee Tobias Stieler had no hesitation in reaching for the red card.
It changed the usually free-flowing Italians to a more defensive approach, with manager Gian Piero Gasperini removing striker Duvan Zapata for an extra defender in Mario Pasalic…and it worked efficiently.
Real were a shadow of the side that has dominated this competition in the past decade, and barely produced a chance worthy of the name.
Casemiro’s header from a Toni Kroos free kick produced a stunning save, and Isco went close before the break, and fed Luka Modric after it, only for the Croat to see his shot deflected inches wide of the post.
But that was it as lame Real looked almost embarrassed in their increasingly frustrated efforts to break down the Italians.