LVIV, Ukraine (AP) -- Cristiano Ronaldo scored two goals and set up two more as Real Madrid weathered a late Shakhtar Donetsk revival to win 4-3 in the Champions League on Wednesday.
Already qualified for the knockout stages, Real's win ensures it will finish top of Group A, while defeat ends Shakhtar's slim qualifying hopes.
Ronaldo opened the scoring with an 18th-minute header off a flick from Gareth Bale, before assisting first Luka Modric and then Dani Carvajal for goals in the space of three second-half minutes.
Ronaldo's second goal in the 70th minute made it 4-0 before Shakhtar's comeback began.
First Alex Teixeira scored from the penalty spot before Dentinho's header cut the deficit to 4-2. Teixeira struck again in the 88th minute but Real held on for the win.