Shakhtar Donetsk 3 Real Madrid 4: Ronaldo wins the group despite late comeback

Real Madrid clinched top spot in Champions League Group A thanks to an enthralling, Cristiano Ronaldo-inspired 4-3 win over Shakhtar Donetsk.

Ronaldo opened the scoring after 18 minutes, turning Gareth Bale's lob across goal over the line, before teeing up Luka Modric to smash home a second just after half-time.

Shakhtar needed a win and a favour from Malmo against Paris Saint-Germain in order to keep their chances of reaching the knockout rounds alive but a fine third goal from Dani Carvajal appeared to end any hopes of a comeback.

Ronaldo steered in his second and Madrid's fourth after some more good work from Bale to cap an impressive display, though Alex Teixeira got a goal back from the penalty spot, before Dentinho's header and Teixeira's clever finish gave Shakhtar hope.

Madrid saw out a victory to help banish memories of their Clasico thrashing by Barcelona, although the loss of Raphael Varane to injury will come as a blow in what was otherwise a largely encouraging 90 minutes for the under-fire Rafael Benitez.

Subdued in the Clasico, Ronaldo looked determined to make amends and fired over the crossbar as early as the second minute to signal his intentions.

Madrid were comfortably on top and took advantage with 18 minutes played. 

Bale raced onto Modric's pass and lofted a square ball over the onrushing Andriy Pyatov to the far post, where Ronaldo arrived to nod the ball over the line despite Yaroslav Rakitskiy's best efforts.

Pyatov reacted well to spurn Ronaldo before the break but Benitez's side looked comfortable with their one-goal lead.

Shakhtar wasted a free-kick in a promising position shortly after the restart and Madrid made them pay with a clinical second goal. Casemiro released Ronaldo with a long ball over the top and the 30-year-old slipped into the path of Modric, who turned a fine finish high past Pyatov from six yards.

Two minutes later, Madrid had their third. 

Ronaldo was again involved, cutting in from the right before passing to Carvajal, who forced his way through the challenge of Marcio Azevedo before bending a superb left-footed effort into the far corner from just inside the area.

Shakhtar tried to respond, Olexandr Gladkiy heading wide, and Ronaldo came close a fourth when he flashed a shot high and wide from the right of the box.

Madrid were in cruise control and Ronaldo finally got his second of the game on 70 minutes. Bale burst clear down the left flank and cut the ball back for the former Manchester United man, who saw his first shot blocked by Pyatov only to be given time and space to tap in the rebound.

Remarkably, Shakhtar suddenly hit their stride. Substitute Taison won his side a 77th-minute penalty after his strong run was halted by a trip from behind by Casemiro, allowing Teixeira to drill into the bottom-right corner past Kiko Casilla.

Dentinho then brought Shakhtar back to within two goals when he bundled home unmarked at the far post after Taras Stepanenko flicked on a corner.

Teixeira gave Shakhtar hope of the most unlikely comeback when he turned and slotted the ball cleverly past Casilla into the bottom corner, but the Ukrainian side will now face Malmo on matchday six in a straight fight for third place and a Europa League spot, while Madrid can look ahead safely to the knockouts.