Real Madrid ensured that they stayed in the title race after taking all three points in a dramatic second half against a Getafe side that will wonder how they let a point escape their grasp.
A dreadful first half from the hosts saw them go behind, before Gonzalo Higuain levelled just before the break and they came out after half-time with more spirit.
Getafe again took the lead though before the inconsistent Guti netted a second equaliser and after Javi Casquero had missed a penalty and Pepe had been sent off, Higuain netted a superb goal to win the game.
A frantic end to the game saw Iker Casillas have to escort Pepe off the pitch and Cata Diaz seeking out Marcelo after the Brazilian taunted the visitors' defender.
Los Merengues knew that this was their chance to close the gap to three points for 24 hours at least, but without Lassana Diarra in the midfield they looked disjointed.
In the opening 45 minutes the hosts' passing deserted them and they offered little cohesion or decisive movement going forward and Getafe were able to take advantage.
Robert Soldado nodded the visitors in front as he was left unmarked in front of goal in the tenth minute moments after shooting over when he should have scored from close range.
It was not until a minute before the break that Madrid were able to find a way through as Cata Diaz paused in the area and Higuain was able to move in and round the impressive Vladimir Stojkovic.
The goal did not prevent the crowd jeering the home team off, but the fans were lifted after the break when the team looked rejuvenated with the introduction of Arjen Robben.
But as Getafe held firm, the game was only just warming up because the action was only just starting as Stojkovic palmed away a drive from Sergio Ramos before Juan Albin miscontrolled in front of goal at the other end.
Robben was on the pitch for all of 17 minutes before going back off again with a knock and while Madrid remained upbeat, their play began to wane once again.
Getafe recognised that and Victor Munoz's substitutions lifted his team, but only after Stojkovic had saved at the feet of Klaas-Jan Huntelaar and Soldado had nodded over a golden chance.
The Getafe keeper has not had many chances to shine since joining the club, but if Los Azulones do go down then he will have no shortage of suitors as he made yet another stop to deny Higuain and from the corner David Cortes nodded Sergio Ramos' effort off the line.
Those saves looked to be even more vital when Uche moved forward in the 84th minute and his high cross-field ball found Jaime Gavilan whose cushioned header in turn found Albin who slotted home superbly from the edge of the area.
Madrid may not have played well and Guti may have endured the odd whistle from the supporters, but he won them back over in the 86th minute as he steered home a free-kick to equalise for the hosts.
It was an incredible finale, but was not over yet as Getafe were handed the chance to go back in front moments later when Pepe nudged Casquero over and was shown a red card.
Replays showed the Portuguese defender kick out at Gavilan after he had gone down and then stamp on the Getafe player before punching Albin as the visitors' players looked to push the aggressor away.
Casillas had to eventually ensure Pepe left the field and the keeper became the hero once again as he stopped Casquero's softly hit spot-kick.
Higuain had been booked for diving when Cata made contact in the area, but the Argentinian was not complaining when in the 93rd minute he turned away from his marker and lifted a left-foot shot into the top corner of the net.
Delerium ensued as Madrid had snatched victory in a game that they rarely looked like winning and put the onus back on Barcelona to perform against Sevilla on Wednesday.
The final whistle saw more ugly scenes as Cata was taunted by Marcelo following a spat during the game, but the Brazilian soon stopped as the huge Getafe defender sought him out for a fight.
Lucas Brown, Goal.com
Know more about Indian international Mahesh Gawli. Please log on to www.maheshgawli.com