MADRID (AP) — With Real Madrid struggling and being jeered by fans, Karim Benzema came through again for the Spanish powerhouse, scoring a pair of goals that included a milestone 1,000th for Madrid in Europe’s top club competition.

Benzema's brace gave Madrid a hard-fought 2-1 win over Shakhtar Donetsk to put the team in the lead of its Champions League group on Wednesday.

Benzema netted the club’s milestone goal in European Cup-Champions League games after the Shakhtar defense gave the ball away less than 15 minutes into the match at the Santiago Bernabéu Stadium.

Fernando equalized for the visitors before halftime but Benzema got the winner in the second half in a match the hosts struggled to control and were jeered by part of the crowd at the Bernabéu.

“We didn’t play well but we got the victory,” Benzema said. “Sometimes you can’t play at your best. The most important thing was to win the three points. It was a difficult match for us, against a very good opponent.”

Madrid hadn’t won at the Bernabéu in three straight matches in all competitions. It had won only five of its last 13 European games at home, with five losses and three draws.

“Sometimes it's good to hear some jeers to get the team going,” Madrid coach Carlos Ancelotti said. “We weren't aggressive enough after starting well in each half.”

The victory left Madrid with nine points in Group D, two more than Inter Milan, which won 3-1 at third-place Sheriff. Sheriff has six points, and Shakhtar is last with one point.

Madrid, which finished second in its group in three of the last five seasons, next visits Sheriff, while Shakhtar travels to Italy to face Inter.

Shakhtar, which started in the third qualifying round, was eliminated in the group stage in 11 of its last 15 seasons, including the last three.

It was Madrid’s second consecutive win against Shakhtar following a 5-0 rout in Ukraine in the teams’ first meeting this season. The teams were in the same group last season as well, with Shakhtar winning both games even though it was Madrid that advanced to the knockout round.

The recent losses to Madrid were Shakhtar’s only defeats in 11 games in all competitions. However, the Ukrainian side has won only four of its last 23 Champions League matches, not counting qualifiers.

Benzema scored the historic 1,000th goal after Shakhtar defender Marlon couldn’t control a pass from goalkeeper Anatolii Trubin inside the area. Vinícius Júnior stole the ball and quickly passed it back to Benzema, who had an open net in front of him for his 62nd goal with the Spanish club in the European competition.

Only Cristiano Ronaldo (105) and Raúl González (66) have scored more goals for the club in the competition than the French striker.

Benzema’s winner came in the 61st after a nice give-and-go between Casemiro and Vinícius Júnior, who ultimately set up the French striker for his low shot from inside the area.

At 33 years, 319 days, Benzema is the oldest Madrid player to score more than once in a match in the European competition since Ferenc Puskás, who was 38 when he did it in 1965.

Benzema is the fourth-fastest player to reach 75 Champions League goals, doing it in 134 appearances. Only Lionel Messi (92), Robert Lewandowski (97) and Ronaldo (111) needed fewer matches.

Fernando equalized for the visitors with a one-timer into the top of the net from inside the area in the 39th after being set up by Alan Patrick, who used his chest to pass the ball to his teammate. It was the sixth goal in the last seven games for Fernando in all competitions.

It was Shakhtar's first goal in the Champions League this season, with its only point coming in a home draw against Inter in the second round.

The Brazilian forward almost scored the second with a low shot from outside the area that required a difficult save by Madrid goalkeeper Thibaut Courtois. Patrick had hit Courtois’ post less than 10 minutes into the match.

___

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

___

Tales Azzoni on Twitter: http://twitter.com/tazzoni