Atletico Madrid overcame an almighty scare to beat Levante 3-2 and go top of the Primera Division.
Diego Costa slammed home a 77th-minute penalty to preserve all three points for Diego Simeone's side, who had gone behind with less than two minutes on the clock and then conceded a second-half equaliser shortly after taking the lead.
Andreas Ivanschitz stunned the Vicente Calderon with an early goal for the visitors, which was eventually cancelled out by a Diego Godin header.
Costa put the hosts ahead two minutes into the second half but Pedro Rios' solo effort on 57 minutes meant Los Rojiblancos required one more goal, which they finally got when Costa fired into the bottom corner from the spot.
Levante came out onto the pitch the stronger side and took a shock lead.
Left-back Nikos Karabelas split the Atleti defence with a low pass and Ivanschitz ran through and shot early, the ball ricocheting off the foot of goalkeeper Thibaut Courtois and into the far corner.
The Belgian goalkeeper, however, produced a superb save to prevent Levante scoring a second after nine minutes, leaping into the air to palm away a David Barral shot that was headed for the top corner.
It was only then that Atletico started to find their feet and went about searching for an equaliser. Juanfran and Gabi sent cross after cross into the Levante box, forcing four corners in the space of six minutes.
Just before the half-hour mark, Atleti's pressure paid off. Juanfran crossed into the box again after his initial attempt was sent back to him, and this time it cleared the defence and landed on the head of Godin, who headed past Keylor Navas.
Costa had two chances to give the hosts the lead before the break, first getting unstuck as he tried to dribble round Navas and then failing by a matter of centimetres to turn in a shot from David Villa that ran across the face of the goal.
Just after the start of the second half Costa got the goal he craved, volleying home from just outside the six-yard box after Gabi had sent in a cross from a free-kick.
But Simeone's side would not settle for a single goal lead and searched for another, and that was their undoing.
Koke was dispossessed by Rios following an Atleti corner and the winger ran through the middle of the pitch unchallenged, and although Juanfran eventually caught up with him the 32-year-old struck the ball beyond the reach of Courtois.
Simeone's side appeared rattled by the equaliser and failed to recapture their rhythm, despite dominating possession and piling forward.
In the end, they had to rely on a penalty, awarded when Gabi was tripped by Ruben Garcia and buried into the bottom corner of the net by Costa.
They will now be hoping their neighbours Getafe can do them a favour when they host Barcelona on Sunday and preserve their place at the top of the table for Christmas. A two-goal win, or one in which Barca score at least three times, would take Gerardo Martino's side back to the summit.