The France defender provided the aerial challenge which led to David Soria's own goal and then headed in the second shortly after half-time.
The win extended Madrid's unbeaten streak to 10 league matches and turned the heat up on title rivals Barcelona, who face a derby against Espanyol later on Saturday.
Madrid, without the suspended Sergio Ramos, started on the front foot with Karim Benzema having a header saved, but they were soon relying on Courtois to keep them level.
The goalkeeper produced a stunning save to parry out Mauro Arambarri's explosive volley from the edge of the area in the 24th minute.
Ten minutes later, and following a brief delay due to a failure with the referee's equipment, Madrid were ahead.
Goalkeeper Soria, under pressure from Varane, failed to punch Ferland Mendy's cross clear as the ball ricochet off his arm and into the empty net.
Faycal Fajr flashed a shot wide as Getafe tried to equalise, while Benzema held off a defender and worked Soria.
Soon it was over to Courtois again to keep Madrid ahead at the break.
The Belgian pushed Fajr's effort wide and then did the same to prevent Leandro Cabrera heading in the equaliser from close range.
Getafe made a lightning start to the second half as Angel Rodriguez fired over and Jaime Mata was denied by a sprawling Courtois, although both were flagged offside.
But Madrid made it 2-0 after 53 minutes when the unmarked Varane headed in Toni Kroos' free-kick, with VAR confirming the Frenchman had stayed onside.
Gareth Bale had a glorious chance to put the game to bed, chipping an effort straight at Soria after he was played in.
And they added a third in added time when Modric converted from Federico Valverde's pass, condemning Getafe to only their second home league defeat this term.