The result ended an 11-game unbeaten run in LaLiga for Los Blancos, Enes Unal scoring the winner.
Madrid had won its past five away LaLiga games, scoring at least two goals in each, but it encountered a hard-grafting Getafe side that stretched its own undefeated streak to six games.
Unal took advantage of a defensive aberration from Eder Militao to strike early in the game, with Madrid frustrated in its efforts to draw level.
Militao was woefully caught out in the ninth minute, after collecting the ball from Toni Kroos on the edge of the penalty area. He stuttered rather than show his usual conviction and Unal exposed the uncertainty, making a careful tackle before firing past Thibaut Courtois, low into the left corner.
Madrid playmaker Luka Modric saw a long-range strike tipped wide and went closer in the 17th minute when he beat David Soria but his 15-yard strike rattled away off the crossbar.
Carlo Ancelotti saw his Madrid team struggle to break down the home defence and was rankled by the officiating of referee Mario Melero Lopez, who might reasonably have booked former Barcelona midfielder Carles Alena.
Alena had committed five fouls by half-time, but it was Ancelotti who picked up a yellow card as he showed frustration on the touchline.
Modric was thwarted by Soria again early in the second half, a tame shot easily gathered, with Madrid struggling to pose a serious threat. Karim Benzema had been quiet but teamed up neatly with substitute Eden Hazard and had a shot from 15 yards headed over the bar by Jorge Cuenca.
Marcelo had his shirt tugged in the penalty area but spot-kick appeals were dismissed, while Casemiro had a thumping 20-yard strike turned wide by the excellent Soria.