Real Madrid need one victory to secure La Liga after they held off a second-half comeback from Granada on Monday to win 2-1 and move four points clear of Barcelona.
With two games left, Madrid will be crowned champions if they beat Villarreal at home on Thursday regardless of how Barca fare at the Camp Nou against Osasuna.
But they were made to sweat by a Granada team that are gunning for Europe and have been arguably the division's surprise of the season after being promoted from second-tier last year.
Ferland Mendy and Karim Benzema looked to have set Madrid on course for a comfortable win at Los Carmenes but Granada were transformed after the break and Darwin Machis' 50th-minute strike gave them hope.
An increasingly nervous Madrid were clinging on by the end and needed Sergio Ramos to clear one shot off the line as Zinedine Zidane's side dug in for a ninth consecutive victory.
"Our vision when we start every season is to win the league," said Zidane.
"There are two games left. We are close but we're not there yet."
When the final whistle blew, Zidane roared with relief and Ramos clenched his fists after coming through their toughest test since the restart.
"We can't relax, we're a bit closer but we have to carry on," said Ramos afterwards.
"We let our guard down here a bit in the second half. We won the first half and lost the second and maybe that's a warning for us. We have to make sure we don't repeat that mistake."
Madrid could win La Liga for the third time in eight years at the Alfredo di Stefano Stadium on Thursday night. "It would mean a lot," said Ramos.
"It's the prize for consistency over the whole year. Maybe we had a period of reflection during the suspension and we came back and reacted. We're in the race and hopefully, on Thursday, we can celebrate."
If Madrid slip up against Villarreal, they will still have a second chance on Sunday when they finish at Leganes while Barcelona visit Alaves.
Machis' goal was the first that Madrid have conceded in six matches but few would have seen it coming after the first half.
Madrid scored twice in six minutes, with both goals coming from breaks down their left.
Mendy had space in front of him and kept going, accelerating between Victor Diaz and Dimitri Foulquier before firing high and into the roof of the net from an acute angle.
The second goal came down the same side, Isco's backheel allowing Luka Modric to switch left to Benzema, who this time cut inside Diaz and shot into the far corner.
Madrid cruised through the rest of the half, pushing the ball around at will, but comfort perhaps created complacency and Granada improved after the break.
Machis pulled a goal back, striking through the legs of Courtois after Casemiro was dispossessed in midfield and Madrid were rattled as Granada began to dictate play.
A scramble in Madrid's six-yard box saw several players hacking at the ball in panic and Courtois was twice required to make smart saves late on.
The closest Granada came was when the ball fell to Ramon Azeez at the back post and he fired towards the near post with Courtois stranded but Ramos was on the line to clear.
Earlier, Villarreal's hopes of Champions League football were dashed after they lost 2-1 at home to Real Sociedad to confirm that fourth-placed Sevilla will join Atletico Madrid, Barcelona and Real Madrid in the competition next season.
Villarreal remain fifth, three points ahead of Getafe and Real Sociedad, with all three hoping to secure a place in the Europa League. Getafe drew 0-0 against Alaves.
Feature image courtesy: AFP / Jorge Guerrero