Benzema made history for Madrid in the first half as his 14th-minute strike marked Los Blancos' 1,000th goal in the Champions League/European Cup.
However, Fernando equalised for Shakhtar six minutes before half-time, with Alan Patrick also hitting the post for the visitors in the first half.
Only the reflexes of Thibaut Courtois prevented Fernando from giving Shakhtar the lead before the interval, but Madrid were better in the second half, which saw Benzema restore their lead following a neat move involving Vinicius Junior and Casemiro.
The win moved Madrid top of Group D ahead of Sheriff's clash with Inter later on Wednesday.
"The most important thing is the three points. We don't play well and we win," Benzema told Movistar. "Sometimes you can't play well. It's normal that the fans want us to always play well, attack and score goals. We try but it doesn't always work out.
"We play every three days and it is difficult. In the end there are many high-level matches like today. Sometimes you win like this, without playing well but in the end we won."