The hosts were gifted a 13th-minute lead as Adrian intercepted Rafa Lopez's wayward pass across his own penalty area and squared for Christian Stuani to roll into an empty net.
However the visitors were behind for only 12 minutes as Jaime Gavilan showed great technique to control and guide home a volley with the outside of his foot from just inside the area.
Goalkeeper Tono Ramirez then rescued Racing early in the second half with saves from Dani Guiza and Miku but the Venezuelan finally found a way through as he showed great composure to slip past Alvaro Gonzalez and lift the ball over Tono for his sixth goal of the season.
Stuani had scored both goals in Racing's 2-0 win at Osasuna last weekend and he was given the easiest of chances to continue his scoring form as Rafa underhit his pass to Cata Diaz and Adrian laid the ball across for the Uruguayan to sweep home his ninth goal of the campaign.
Despite that early setback though Getafe played the better football throughout and were denied an immediate response when Tono stole the ball from Guiza's feet as the former Spain international tried to round the keeper.
Six minutes later Racing did concede for the first time in four league games as Gavilan netted for the first time since returning from a long-term knee injury. The midfielder collected a deflected cross from the right before placing an accurate shot into the far corner.
Guiza had a great chance to end his barren run in front of goal seven minutes into the second period but Tono again did well to block his shot from point-blank range before smothering the rebound.
Miku was next to be denied by the Racing keeper as his powerful effort from outside the box was parried away before Miguel Angel Moya was called into action to keep Getafe level as Lautaro Acosta smashed the ball against Moya's face when clean through on goal.
Getafe deservedly got the all important third goal on 83 minutes as Miku took his time to waltz past desperate challenges from Marc Torrejon and Gonzalez before chipping the ball over Tono.
The action was not finished though as a combination of luck and good goalkeeping from Moya denied Acosta in the final minute as his shot from distance squirmed under the keeper's body but rolled just past the post.
The win moved Getafe four points clear of Racing, who remained just two points off the relegation zone.