Kylian Mbappe opened the scoring from the penalty spot in the 11th minute after he was brought down inside the box. Real Madrid quickly doubled their advantage as Jude Bellingham finished calmly in the 21st minute after being played through by Arda Guler.
Madrid were firmly in control and added a third before half-time. Yan Diomande produced the highlight of the evening in the 36th minute, smashing a superb half-volley into the top corner after Racing failed to clear Guler's corner.
Racing struggled to create clear opportunities, with Thibaut Courtois making a key save from Iker Luque early in the game. Madrid also came close to adding a fourth after the break, with Mbappe hitting the post.
Racing were briefly awarded a penalty in the second half after the ball struck Aurelien Tchouameni's arm, but the decision was overturned following a VAR review.
Real Madrid controlled the closing stages and thought they had scored a fourth through Bellingham in stoppage time, only for the goal to be ruled out for offside.
The victory leaves Madrid one point behind Atletico Madrid and three points behind Barcelona, while their winning streak now stands at six matches.
Madrid will next turn their attention to the Champions League, travelling to Athens to face AEK on Wednesday.