Philippe Coutinho and Neymar bailed Brazil out with stoppage-time strikes against Costa Rica following another uninspiring display at the 2018 World Cup.
Coach Tite’s team were heading for a second inglorious draw when Barcelona midfielder Coutinho popped up to poke home from Roberto Firmino’s nod down.
And with seconds remaining Neymar, the world’s most expensive player, tapped in Douglas Costa’s cross to secure Brazil’s first win of the tournament.
Their hopes of victory looked to have been dashed when they had a penalty decision overturned by VAR in the 78th minute after referee Bjorn Kuipers had initially ruled Neymar had been brought down in the area.
As it stands Brazil currently lead Group E and could go through with a draw in their final pool match against Serbia.
Is this Brazil 1994 in disguise?
How this Brazil side could do with just a sprinkling of the brio of the teams of 1970 and 1982.
In the two games they have played so far the class of 2018 have been pedestrian for long periods – reminiscent of Carlos Alberto Parreira’s heavily-criticised champions from 1994.
Even that side scored more goals in their opening two games than Tite’s outfit, who too often are cautious in their approach play and whose illustrious attack have yet to replicate their club form.
Brazil were listless in the opening 45 minutes.
After being fouled 10 times in the opening game against Switzerland, Neymar, perhaps unfairly criticised after that match for not being a team player, was once again targeted by defenders and spent more yet time with his face in the turf.
Barcelona’s Coutinho, who scored with a brilliant strike in the opening game, failed to find his range and Chelsea’s Willian, taken off at half-time, was awful on the right.
The tempo increased, as did the chances for Brazil, after the break, although prior to the goals Costa Rica keeper Keylor Navas was only tested by Neymar’s snapshot, while Jesus’ header came off the woodwork.
With 15 minutes remaining it was desperation time for the five-time winners, with Tite and the vast number of Brazilians inside the Saint Petersburg stadium hoping for a miracle.
Neymar tears after late goal
Those prayers appeared to be answered with 12 minutes remaining, as official Kuipers pointed to the spot after he judged Giancarlo Gonzalez had pulled down Neymar.
However, after watching the replay the experienced Dutchman overturned the decision – and Brazilian shoulders slumped.
Then came the breakthrough, with the fourth official signalling six minutes of stoppage time.
With one minute of it played, Coutinho broke the deadlock when he fired in after substitute Firmino and Jesus had combined.
And in the dying seconds, Neymar, only recently recovered from a broken foot, tucked home Juventus midfielder Costa’s square ball.
Brazil’s talisman wept after the final whistle – the win relief both for him and for his nation.
Costa Rica bid farewell after valiant effort
It was a commendable defensive display by Costa Rica, who had hoped to punish Brazil on the counter-attack.
However, their only opportunity came in early in the first half when Celso Borges fired wide after a good run and cross from Celtic’s Cristian Gamboa.
There will be no repeat of 2014, when Los Ticos reached the last eight.
‘I think I pulled a muscle’ – the reaction
Brazil coach Tite, who tripped over as he ran on the field to celebrate Coutinho’s opener: “I think I kind of pulled a muscle.
“I’m limping now after the celebration. We were a bit over-excited.
“The first half was difficult but in the second half, we couldn’t have done any more. If we have suffered in these first two games, it is simply because this is a World Cup.
“If you look at the games yesterday, and the favourites so far, they are either losing or they are finding it tough and maybe winning 1-0.”
Brazil goalscorer Coutinho: “It was a tough game as we expected. We showed good patience to play until the last minute where we were rewarded with those two goals.
“We know the responsibility is huge when you’re playing for Brazil. Emotionally, the professor (Tite) always highlights the mental strength we need from the start to the end.”
Costa Rica coach Oscar Ramirez on his defensive tactics: “I don’t know what else we could have done.
“What we did I think was perfect. You have to think we were playing against the second best team in the world. They have great players.
“Considering what I have at my disposal and what they have, I think it is reasonable what we did.”
Man of the match – Philippe Coutinho (Brazil)
Lucky 13 for Brazil – the stats
This was Brazil’s first World Cup victory thanks to a goal scored in the 90th minute.
Brazil have won 10 of their 11 meetings with Costa Rica in all competitions, the one loss coming in a friendly in 1960.
Costa Rica are winless in their last five World Cup matches (D3 L2).
Costa Rica had just three shots in this match, with all of those coming in the opening 15 minutes.
Brazil’s second goal was timed at 96:49 – the latest recorded stoppage time goal in a World Cup match since 1966.
Brazil are unbeaten in 13 games (W9 D4 L0), conceding just three goals in that run.
Brazil’s Neymar has been fouled 14 times so far in the 2018 World Cup, more than any other player.
Neymar has been involved in 18 goals in his last 17 appearances for Brazil (10 goals, eight assists).
Coutinho has been directly involved in four goals in his last four games for Brazil (three goals, one assist), as many as in his previous 14 combined for the national side.
Brazil face Serbia in their final game next Wednesday (19:00 BST) in Moscow, and Costa Rica end their campaign against Switzerland (19:00 BST) in Nizhny Novgorod on the same day.