Madrid had won their last seven league meetings against Getafe and appeared set for another triumph when Gonzalo Higuain put them ahead in the 27th minute.
However, Getafe hit back in the second half to stun their star-studded opponents with goals from Juan Valera and Abdelaziz Barrada.
That completed a forgettable first week to the new campaign for Jose Mourinho’s side, who started their title defence with a 1-1 home draw against Valencia last weekend before losing 3-2 to arch rivals Barcelona in the first leg of the Spanish Supercopa on Thursday.
Barca had earlier battled back from a half-time deficit to beat Osasuna 2-1 away but precisely the opposite happened to Madrid at the Coliseum Alfonso Perez and they now find themselves five points adrift of the leading sides in La Liga.
Few of the divisions big guns relish going to Getafe, who last season beat Barca, Valencia, Sevilla and Atletico Madrid at home, but Real have dominated their neighbours in recent years and looked on course for another victory midway through this latest game.
Mourinho’s men really have should have taken the lead in the 16th minute but Mesut Ozil somehow contrived to miss an open goal from five yards out.
The Germany international and Cristiano Ronaldo combined superbly to rip open the Getafe defence but, after Ronaldo had unselfishly rolled the ball across the edge of the six-yard box – leaving home goalkeeper Miguel Moya stranded in the process – Ozil side-footed his shot against the crossbar when it looked easier to score.
That miss did not look like being too costly though as Madrid took the lead 11 minutes later through Higuain.
Angel Di Maria’s pinpoint pass found Higuain on the edge of the area and, despite the combined efforts of Alexis, he managed to skip past Getafe goalkeeper Miguel Moya and slot home left-footed.
That goal separated the sides at the break, but parity was restored just seven minutes after the restart when Valera sent a glancing header from Barrada’s right-wing free-kick past Iker Casillas and inside the far post.
It was to get even worse for Madrid in the 75th minute as Getafe took the lead.
Adrian Colunga got goal-side of Raul Albiol as he brought down a high ball near the halfway line and he immediately sped away from the Madrid defender before laying the ball inside to Barrada, who charged into the area before thumping a rising shot past Casillas.
It very nearly became 3-1 two minutes later but Casillas was able to parry away Xavi Torres’ low shot to keep shellshocked Madrid still in the game.
The visitors, despite an embarrassment of attacking talent on the pitch, could not capitalise on that save though as the Getafe defence kept them at bay in the closing stages to claim their first points of the season.