The reigning champions took an early lead through Gonzalo Higuain and had chances to extend their advantage, most notably an early contender for miss of the season from Mesut Ozil, who hit the bar from four yards.
Getafe responded well in the second half and took advantage of some poor Madrid defending to make a surprise comeback.
First Juan Velara beat Xabi Alonso to head home from a set-piece to even the scores.
Madrid failed to recover and fell behind with fifteen minutes to go.
Abdel Barrada beat the offside trap and got the benefit of a contentious handball decision to slot home the winner.
Madrid could not find a way back into the match and are now five points behind Barcelona after just two La Liga matches.