Brazil’s Neymar reacts at the end of 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. (AP Photo/Michael Sohn)

Philippe Coutinho and Neymar both scored in second-half stoppage-time to give Brazil a crucial 2-0 win against Costa Rica at Krestovsky Stadium in St Petersberg.

Coutinho finally broke the deadlock in the 91st minute before Neymar found the net in the dying seconds to secure Brazil’s first victory of the 2018 World Cup.

The result sees Brazil move top of Group E ahead of Serbia, who play Switzerland at 7pm in Friday’s evening match.

A second straight defeat for Costa Rica in Russia means they cannot qualify for the knockout stage like they did at the 2014 World Cup.

It looked as though it wasn’t going to be Brazil’s day when, in the 78th minute, they had a penalty decision overturned by VAR.

Referee Bjorn Kuipers changed his original decision to award a spot-kick for a challenge on Neymar by Oscar Duarte after watching a VAR replay pitch-side.

Despite Brazil’s dominance, Costa Rica could have taken the lead after 13 minutes when Celso Borges fired a great chance wide after an excellent run and cross by Cristian Gamboa.

Brazil had the ball in the net in the 26th minute but Gabriel Jesus was offside as he lashed home from 15 yards.

The tournament favourites struggled to test Costa Rica and Real Madrid goalkeeper Keylor Navas in the first-half as they were largely limited to long-range efforts.

Douglas Costa’s introduction at half-time helped spark Brazil into life at the start of the second-half, with chances falling to Neymar, Coutinho and Costa himself within 15 minutes of the restart.

Gabriel Jesus came closest when his looping 50th minute header hit the crossbar from right-back Fagner’s cross.

Brazil continued to control the ball and were camped in Costa Rica’s half, although, Miranda had to be alert to cut out Bryan Ruiz’s dangerous cross on 68 minutes.

Neymar was heavily involved in the last 20 minutes, curling an effort just wide from 18 yards in the 72nd minute, before reacting furiously when the penalty decision was overturned shortly after.

The breakthrough eventually arrived in the first minute of stoppage time when Jesus’ touch fell to Coutinho, who poked the ball home from close-range for his second goal in as many matches.

The goal led to dramatic celebrations by Brazilian substitutes and manager Tite, who stumbled as they invaded the pitch.

Brazil’s two stand-out players then combined in the 96th minute to add a second, as the substitute Costa crossed to Neymar, who volleyed the ball into an empty net.

Brazil XI: Alisson, Fagner, Thiago Silva, Miranda, Marcelo, Paulinho, Casemiro, Coutinho, Willian, Gabriel Jesus, Neymar.

Subs:

Douglas Costa, Roberto Firmino, Fernandinho.

Costa Rica XI: Navas, Acosta, Gonzalez, Duarte, Gamboa, Borges, Guzman, Oviedo, Venegas, Ruiz, Urena.

Subs:

Bolanos, Calvo, Tejeda.