The clock had ticked past 90 minutes, and the five-times champions looked to be edging to a second disappointing draw, when Marcelo floated the ball in from the left and substitute Roberto Firmino headed across to Gabriel Jesus.
Neymar seemed panicked for most of the second half as his shots sailed over the bar or simply missed the mark, and he complained about almost every call. The penalty was awarded after a video review showed that Alfred Finnbogason had been brought down by Tyronne Ebuehi.
Neymar's endured a hard week and it was clearly too much for him after the final whistle.
This may be good news for Brazil, but, Costa Rica will be hoping to turn their World Cup around and will be planning a comeback after their 1-0 defeat to Serbia. But if Argentina claims all three points, it can still advance depending on the result of the other match between Croatia and Iceland.
Neymar is one of the best players in the world, and that status has made him a target for opposing defenses.
The 23rd-ranked team has always been a long-shot to win the Cup this year, having only progressed to the quarter-finals in 2014.
How this Brazil side could do with just a sprinkling of the brio of the teams of 1970 and 1982.
That said the onus will be on Iceland to get a win in this match as there is still a chance that they could make it to the second position in the Group table, and to be honest I cannot see Nigeria putting up much of a fight!
The second half was proved intense, as Brazil appeared more aggressive from the beginning, with mounting threats in Costa Rica's half. "Nothing in my life was ever easy and that's not going to change now".
Neymar's obsession with social media has undoubtedly opened him up to more criticism - and pressure - than ever but former players acknowledged even the most balanced individual is under massive stress in Russian Federation.
"It was handsome, perfect", Tite said of Brazil's second-half display.
Brazil's Neymar reacts after missing a chance to score during the group E match between Brazil and Costa Rica at the 2018 soccer World Cup in the St. Petersburg Stadium in St. Petersburg, Russia, Friday, June 22, 2018.
"We don't need referees to win the game". Miranda and Thiago Silva are the centre-backs, with Alisson in goal.
The finish was frantic as Brazil swept forward in waves, only to be repelled time and again by Costa Rica's stubborn defence, until Coutinho came to the rescue.
- Cardi B Donates $8000 to Family of Boy Murdered in The Bronx
- Full time: South Korea 1 Mexico 2
- #WC2018: Hernandez nets as Mexico sees off South Korea
- Spain and Portugal Should Win Easily Today
- Turkish President Recep Tayyip Erdogan wins second term in a landslide victory
- Trump blasts Harley plan to shift United States production to avoid European Union tariffs
- Colbert Mocks Melania Trump's Jacket
- BBC forced to apologise due to Nick Kyrgios' actions during Queen's match
- Mohamed Salah considering quitting Egypt team over Ramzan Kadyrov row
- Sales tax ruling overturns decision in North Dakota case