However, VAR intervention led to a reversal of the decision, as replays showed minimal contact between Gonzalez and Neymar, who had fallen backwards as if pulled down.
Brazil went into the break with the boos and whistles of their fans ringing in their ears but emerged with a renewed sense of goal, with Jesus heading against the bar four minutes after the restart and Coutinho sending the follow-up effort narrowly wide.
At the final whistle, Neymar sat down on the grass and wept, with the emotion of victory hitting home after a tense Group E contest at the Saint Petersburg Stadium.
"In my life things have never been easy, why would they be now?"
After the referee stopped play to attend to a Costa Rica player, Thiago Silva sportingly kicked the ball back to Brazil'a opponents.
Neymar faced the most devoted of markers in Costa Rica's Cristian Gamboa, the Brazilian spending most of the half hopping over scything tackles or dodging past a barging shoulder.
Earlier in added time Philippe Coutinho had broken the deadlock, after a Brazil penalty had been ruled out thanks to VAR.
That incident threatened to dominate the headlines until Coutinho prodded Brazil in front in the 91st minute, getting on the end of a Roberto Firmino nod down and a helpful touch from Jesus.
The iconic striker fired Brazil to 2002 World Cup glory and it's now been revealed what he's been doing for the world's most expensive footballer in Russian Federation.
Coutinho got the victor in the 91st minute, and Neymar got his goal later in stoppage time as the South Americans move to four points in Group F and have a little breathing room with one match to play.
Ex-Tottenham star Paulinho started for Brazil and remained on the pitch for 68 minutes against Costa Rica.
Tej became the first-ever Indian ball-boy to feature in a FIFA World Cup.
In fact, Willian would fail to make a difference on the wing that it forced Brazil to be restricted on their attack, and it failed to break through a strong defensive stance from the Costa Ricans. "He played his first 90 minutes [against Switzerland] in three-and-a-half months", he said.