Madrid's surprise defeat gives fresh hope to the beleaguered chasing pack in Spain, after Eder Militao's early error allowed Enes Unal to score the winner at the Coliseum Alfonso Perez.
Sevilla, Madrid's closest challengers, will be five points behind the leaders with a game in hand if they win at Cadiz on Sunday. Getafe stay 16th after recording only their fourth league victory of the season.
Madrid have taken command of the Spanish title race after a superb run of form that included 10 consecutive wins and 15 matches without defeat, their last loss coming at Espanyol on 3 October.
But Carlo Ancelotti's side were woefully out of sorts in their first outing of 2022 and, aside from a brief spell in the first half, struggled really even to threaten the Getafe goal.
Eden Hazard came on at halftime but again failed to shake his team into life while Karim Benzema was unusually quiet up front. Madrid certainly missed the penetration of Vinicius Junior, who was absent after testing positive for COVID-19.
Ancelotti's mood was summed up in the second half when the deflated Italian on the bench slumped over and dropped his head after a Toni Kroos free-kick drifted harmlessly out of play.
Getafe lost eight games in a row earlier in the season but came in on the back of an upturn in form under Quique Sanchez Flores, having gone five games unbeaten, including a pair of wins over Cadiz and Osasuna.
Unal gave them the lead in the ninth minute after the usually dependable Militao was caught napping.
The Brazilian went to clear on the edge of his own area but instead took an extra touch, engaging in a tussle with Unal, who robbed the ball and finished past Thibaut Courtois.
Madrid dominated for 20 minutes, with Luka Modric increasingly influential, but a dogged Getafe preserved their lead for the rest of the first half and were relatively comfortable in the second.
Hazard and Marcelo both came on at halftime but neither made much of an impact, with Hazard unable to muster a single attempt on goal. Benzema had a shot blocked, Casemiro saw a half-volley saved and Mariano Diaz headed over, but Getafe deserved their victory.