Karim Benzema came off the bench to give Real Madrid a 2-1 win over 10-man Sporting and keep their hopes of finishing top of Champions League Group F alive.
Borussia Dortmund lead the way heading into the final matchweek, holding a two-point advantage following a scarcely believable 8-4 win over group whipping boys Legia Warsaw.
Madrid appeared condemned to second place when Adrien Silva's penalty cancelled out Raphael Varane's 29th-minute opener, despite Joao Pereira having already seen red for inexplicably punching Mateo Kovacic in the stomach.
Sporting managed to keep returning hero Cristiano Ronaldo quiet, as he failed to score in a match against one of his former sides for the first time in the Champions League, but they could not prevent Benzema from expertly heading home Sergio Ramos' curling free-kick five minutes from time.
Jorge Jesus' side are out but will prolong their European season by dropping down to the Europa League if they avoid defeat at Legia in the final group match, while opposite number Zinedine Zidane will hope the knock to the ankle that saw Gareth Bale limp off during the second period is nothing too serious with the first Clasico of the season against Barcelona 11 days away.
Madrid captain Ramos was forced into an early last-ditch tackle on Silva, while Ronaldo had an early sighter – dragging wide left footed in the fourth minute.
It was an enterprising start from the hosts and they continued to threaten down the flanks, with a sliding Bas Dost unable to get on the end of a low Gelson Martins' cross at the back post.
Dost was culpable when Madrid took the lead in scrappy fashion, playing Varane onside when Sporting failed to clear and Ronaldo's scuffed attempt spun into his path.
Sporting almost hit back instantly and Bruno Cesar's shot was destined for the net until Ramos intervened with a headed block to deflect the ball behind.
Cesar, who put Sporting ahead in their 2-1 loss at the Santiago Bernabeu in September, whipped a free-kick wide with Madrid goalkeeper Keylor Navas scrambling after Marcelo was booked for bringing down Martins – the hosts wanted a penalty but referee Willie Collum correctly ruled the contact took place just outside the box.
Sporting resumed after half time on the front foot but Madrid stood firm, with clear chances proving hard to come by.
Bale limped out of the action after taking a blow to the right ankle in a challenge with Sebastian Coates, although Pereira's idiocy meant any advantage Sporting might derive from that was short-lived.
Jesus' men had a free-kick in a promising position on the right when Marco Asensio brought down fellow substitute Joel Campbell, only for Periera to lash out at Kovacic in the immediate aftermath.
Nevertheless, with nothing to lose, Sporting continued to attack and pulled level with 10 minutes remaining.
To the delight of the home faithful, Madrid's former Benfica substitute Fabio Coentrao handled in the area as he kept his arms in the air to appeal for an infringement by Campbell.
Silva drove home from the spot unerringly and the decibel level rose inside the Estadio Jose Alvalade as the prospect of a stunning comeback came into view.
But Benzema had the final word, stealing in front of Coates to head his sixth goal of the season and challenge Dortmund to avoid defeat in Madrid.