Real Madrid threw away their lead and perhaps their hopes of catching Barcelona as Girona came from behind to pull off a shock 2-1 victory at the Santiago Bernabeu on Sunday.
Girona had not won in 13 matches and looked on course for a seventh straight defeat when Casemiro headed a dominant Madrid ahead in the first half.
But complacency set in, and Girona took full advantage as Cristhian Stuani scored a penalty and Portu nodded in at the back post, leaving the European champions scrapping even for a point before Sergio Ramos was sent off in the 90th minute.
They failed even to muster that, with defeat here a major act of self-harm for what was beginning to look like a serious resurgence in La Liga's title race.
Barcelona had beaten Real Valladolid by a single goal on Saturday but their stodgy display continued a period of uncertainty for the Catalans, who still have to go to the Bernabeu later this month.
That Clasico will be a lot less nervy now, given Barca's cushion has been extended to nine points over Real, with Atletico jumping back above them into second, seven points off the top.
The frustration for coach Santiago Solari will be that his team had this game in the palm of their hands, in control against a Girona side that celebrated at the end as if they had secured survival.
Their first league victory since November pushes them four points clear of the bottom three.
Solari will take some of the blame after he fielded a rotated line-up following the Champions League win over Ajax in midweek, their seventh win in eight games.
Gareth Bale and Vinicius Junior both started on the bench, while Luka Modric was suspended.
Madrid barely broke sweat in the first half, in control but playing within themselves as long spells of possession were only occasionally turned into a clear-cut chance.
The best move was marked by two scoops, the first by Toni Kroos, who lifted the ball over Pere Pons and squared for Lucas Vazquez, who repeated the trick, dinking it between two defenders, only for his finish to be saved by Bono.
Girona threatened in flashes. Stuani drew a decent stop from Thibaut Courtois and Alex Granell's drive whistled past the post.
But Madrid never looked troubled and it was no surprise when Casemiro nodded in Kroos' cross after Bono elected to punch rather than catch the initial ball in.
Eusebio brought on both Aleix Garcia and Anthony Lozano at half-time, and the impact was almost instant, as Garcia blazed over the rebound after Lozano's header.
Madrid slipped from comfortable to complacent and shortly after the hour they were punished. Stuani's header spilled out to Douglas Luiz, whose finish was blocked by the hand of Ramos.
Girona almost scored again, Portu's shot rattling the outside of the post, and then they did. Casemiro missed a tackle in midfield and Lozano's shot was parried to Portu. Marcelo dangled a leg but failed to stop the header, which crept inside the post.
Messi scored a penalty and missed another as Barcelona ground out an unconvincing 1-0 win over Real Valladolid, while Antoine Griezmann surpassed Fernando Torres with his 130th goal for Atletico Madrid.
Griezmann scored a second-half winner in Atletico's 1-0 victory at neighbours Rayo Vallecano to provide a timely boost going into next week's showdown with Cristiano Ronaldo and Juventus.