Cristiano Ronaldo and Real Madrid bounced back from the El Clasico debacle with victory over Shakhtar Donetsk in the UEFA Champions League, but it was far from straightforward.

For the bulk of the match, it seemed like Real Madrid were cruising to victory, after Ronaldo gave his team the lead on 18 minutes, before goals in the 50th and 52nd minutes from Luka Modric and Dani Carvajal made it 3-0.

If the game wasn't put to bed by then, it certainly seemed the case when Ronaldo netted his second on 70 minutes, but Shakhtar refused to go away, setting up a thrilling finale by scoring three goals in 11 minutes.

Two Alex Teixeira goals, one a penalty, and one from Dentinho made it 4-3 with two minutes plus stoppage time to go, but Real Madrid just about prevented the equaliser from going in to seal top spot in Champions League Group A.

"Overall I'm satisfied with the result," Real Madrid's beleaguered manager Rafa Benitez told UEFA's official website. "We played at a very high level for most of the match and controlled the game.

"However, after the mistakes leading to goals from the penalty spot and a corner everything changed very fast. Perhaps we lacked concentration, but we will analyse our mistakes. In general, my impression was positive.

"Most important is that we have earned three points and secured first place in the group. We scored four goals against a very strong side away from home, so my team deserve praise.

"This is the first step for us in returning to our usual top level. Both teams are famous for their attacking play, so it's not surprising that so many goals were scored in the match."

Shakhtar Donetsk, who are out of the Champions League with this loss and PSG's victory over Malmo, will take heart from that splendid near-comeback, but Mircea Lucescu believes the match was lost when his team conceded an avoidable first goal to Ronaldo in the first half.

"The only positive was the last 20 minutes," Lucescu said. "The introduction of Taison shook up my other attacking players -- the whole team woke up. I said that we would score, but need to avoid defensive errors. Unfortunately, we conceded a silly first goal and Madrid took control of the game.

"We have mentality problems as my players often lose heart after conceding a goal. It's a pity that even experienced players made mistakes."