Brazil scored twice in stoppage time to defeat Costa Rica 2-0 to keep their World Cup bid on track.
Philippe Coutinho and Neymar both struck to earn Brazil their first win of the competition to edge them towards the last 16.
The five-time winners and the competition’s most decorated nation were on course for their second successive draw in Russia, with Neymar denied a second-half penalty upon VAR review and Gabriel Jesus hitting the crossbar.
However, Coutinho arrived to poke an effort between Keylor Navas’ legs at the start of stoppage time before Neymar converted substitute Douglas Costa’s cross to earn Tite’s men a crucial victory and ensure their opponents cannot quailfy from Group E.
Brazil had hoped to name an unchanged XI, yet an injury to Danilo meant Corinthians’ Fagner had to be drafted in at right-back.
Yet it was down the other flank, where Marcelo and Neymar were operating, where they were nearly caught out early on.
Celtic full-back Cristian Gamboa reached the byline and pulled the ball back for Celso Borges to steer a first-time shot wide of the post.
Brazil were failing to sparkle again, with Neymar once more largely ineffective, though they did have a goal disallowed when an offside Jesus collected Marcelo’s shot and steered home.
That appeared to lift Tite’s side and Marcelo and Coutinho were both narrowly off target with shots from range before the former brought a save out of his Real Madrid colleague Navas.
Costa replaced Chelsea winger Willian at the start of the second period and there was immediately a greater urgency from Brazil.
A Jesus header came back off the woodwork, Coutinho’s effort was diverted past the post by Gamboa and Navas tipped Neymar’s shot over the top as Brazil turned the screw.
With less than 20 minutes to go, and Liverpool forward Roberto Firmino now on the pitch, Neymar seized upon a loose touch from Gamboa and lined up a shot from the edge of the box that he whipped wide.
It was looking like it might not be his, or Brazil’s, day but he thought that might be about to change with 13 minutes to go when referee Bjorn Kuipers pointed to the spot as Neymar fell backwards when trying to cut across Giancarlo Gonzalez.
Los Ticos were incensed and the decision was overturned upon a VAR review. Though Gonzalez had grabbed at Neymar’s shirt while slipping, there was minimal contact and the Paris St Germain star’s dramatic flop was considered to be unnecessary.
Neymar then earned a booking for punching the ball into the ground as his frustrations came to the fore, yet all of that was alleviated with two late goals in stoppage time.
Firmino’s header back across the box was not brought under control by Jesus but Coutinho arrived at the right moment to stab in past Navas, causing Tite to tumble onto the pitch in celebration.
Neymar then looked determined to make a positive impact on the game – at one point flicking the ball over a defender’s head near the corner flag – before volleying in Costa’s cross in one of the game’s final acts.