Champions League: Cristiano Ronaldo at double but Real Madrid made to sweat by Shakhtar Donetsk
Real Madrid struggled to put Saturday's nightmare 4-0 home defeat to Barcelona behind them, just about surviving a stunning fightback by Shakhtar Donetsk to win 4-3 and finish top of Group A.
Two goals from Cristiano Ronaldo, Luka Modric's powerful drive and Dani Carvajal's neat finish put Real 4-0 up with 15 minutes to go.
However, Alex Teixeira pulled one back from the penalty spot for the home side before Dentinho headed in a second.
Teixeira's low finish set up a tense finish, but Real - who included Gareth Bale in their starting line-up - held on.
The three goals were the first Rafael Benitez's side had conceded in this season's Champions League and took the shine off what had looked like being a good response to the shocker against Barcelona at the Bernabeu at the weekend.
Zlatan Ibrahimovic did not celebrate when he scored on his first return to hometown club Malmo, Paris St-Germain winning 5-0 to reach the last 16.
Ibrahimovic went off to a standing ovation from both sets of fans when he was substituted late on.
Ibrahimovic said: "I got goose bumps. It felt like I was home again. This is the icing on the cake. I've been through a lot, and now this.
"I do not know how much there is left but hopefully something more so I get to experience it too. But this is a great moment for me, my family and everyone who hung on.
"This was where it all began and to come here with PSG when I'm on top and do what I do best: playing football.
"I do not know how many people get to experience it, but I do not care about it because I have experienced it."
The Swede played for Malmo between 1999 and 2001 and powered in from the left in the second half to score his side's third.
Adrien Rabiot headed in PSG's first before Manchester United flop Angel Di Maria made it 2-0. After Malmo's Markus Rosenberg missed a penalty, Di Maria's header and Lucas Moura's free-kick wrapped up the scoring.