Luis Suarez's 88th-minute winner against Osasuna has left Atletico Madrid on the brink of clinching the La Liga title for only the second time since 1996.
Diego Simeone’s side were staring at a shock defeat after Ante Budimir headed the visitors in front with just 14 minutes remaining.
But substitute Renan Lodi netted for Atletico in the 82nd minute before Suarez’s late decider.
Atletico, who were champions in 2014 under Simeone, head into the concluding round of fixtures next Sunday with a two-point advantage over Real Madrid.
Los Blancos kept alive their hopes of retaining their title following a 1-0 win at Athletic Bilbao, Nacho Fernandez scoring the only goal of the game midway through the second half.
Real host Villarreal on the final day, while Atletico travel to Real Valladolid.
Santi Mina shattered Barcelona’s dwindling hopes of winning the title as his brace for Celta Vigo condemned Lionel Messi and company to a 2-1 defeat at the Nou Camp.
Messi briefly dragged Barca to within two points of Atletico when he put his side ahead, but Santi’s double created an insurmountable gap for Ronald Koeman’s men.
The result means the Catalan club will finish outside the top two for the first time since 2008 as their Madrid rivals Real and Atletico are now out of reach.
Elsewhere in Spain, Eibar were relegated from La Liga following a 4-1 defeat at Valencia. The result leaves them three points behind Huesca, who lost 1-0 away at Real Betis, with a worse head-to-head record.
Elche won 3-1 at Cadiz to provide themselves with a chance of staying up.
Carlos Bacca scored a hat-trick as Villarreal secured a 4-0 win against 10-man Sevilla, while Real Sociedad also scored four times in a 4-1 home win against Valladolid.
Takefusa Kubo struck in the 84th minute in a 2-1 triumph for Getafe against Levante, while Alaves ran out 4-2 victors against Granada.