Jamie Vardy scored a dramatic injury-time goal to send Leicester into the knockout stage of the Europa League with a draw against Braga.
The substitute turned home Marc Albrighton’s cross as the Foxes came from behind three times to draw.
Al Musrati blasted Braga ahead and Harvey Barnes equalised before Paulinho netted for the hosts.
Luke Thomas got the Foxes level and Fransergio looked set to win it for Braga before Vardy’s late goal.
Zorya Luhansk’s 3-0 win at AEK Athens in the group’s other game meant a draw was enough for Brendan Rodgers’ side.
The Foxes were indebted to goalkeeper Kasper Schmeichel for keeping them in the game at stages, before the visitors’ substitutes turned the game round.
Leicester – perhaps buoyed from a comfortable 4-0 win in their previous meeting with Braga – kept many of their stars on the bench in case of emergency.
In the end they needed them.
Braga fully deserved their 2-1 half-time lead as Al Musrati drilled home and Ricardo Horta rounded Schmeichel before finding Paulinho. In between those goals, Barnes smashed home from a tight angle.
Schmeichel denied Paulinho on three occasions and Horta on another.
The turning point was the half-time introductions of Wesley Fofana and Youri Tielemans, and the 62nd-minute introduction of Vardy and James Maddison.
Vardy had a goal ruled out for offside moments after coming on and Fofana started a move and Maddison crossed for teenager Thomas to score his first goal in professional football and become Leicester’s youngest European goalscorer.
Leicester’s decision to look for a winner appeared to have backfired when goalkeeper Matheus caught a cross and started a quick counter which ended in Wenderson Galeno finding substitute Fransergio to put Braga 3-2 up in the 90th minute.
But Vardy started a move which he then finished when he stabbed home Albrighton’s cross at the back post.
One more win will clinch the group for Leicester but Rodgers has the luxury of fielding a weak team in the final two games if that is not a major priority.
Leicester boss Brendan Rodgers said that their plan was to play the system we were in, and if we had to chase the game we would change the shape 3-1-4-2 and those players [Maddison and Vardy] would change the dynamic of the game.
He also added that Maddison and Vardy are highly gifted players and they made a big difference.
“In the first half we were too slow in our movement, too static and we weren’t aggressive enough. In the second half, we were outstanding.
“Youri [Tielemans] came on and dictated the tempo of the game. In the second half we were excellent with the football and Youri and James [Maddison] were the catalysts for that.”