ST. PETERSBURG, Russia (AP) -- After more than 90 minutes of aggravation and exasperation, Neymar and Brazil finally broke through Costa Rica's smothering defense.
Philippe Coutinho scored in the first minute of stoppage time, and Neymar followed six minutes later to give Brazil a 2-0 victory over Costa Rica on Friday at the World Cup.
Unlike Argentina and Lionel Messi, Brazil is still in a good position to advance to the round of 16. Costa Rica has been eliminated.
"The responsibility is huge when you are playing for the national team," Coutinho said through a translator. "You have to be mentally strong from the beginning until the end. We fought until the end and we were rewarded."
Neymar dropped to his knees after the final whistle, sobbing in his hands as his teammates surrounded him and then lifted him off the ground.
"We know he had a difficult injury, he went through a very bad patch," Coutinho said, referring to Neymar breaking a bone in his right foot four months ago. "But his joy at being on the pitch is contagious."
A few minutes before the end, Neymar flopped backward to initially earn a penalty, but the contact was so exaggerated that the referee reversed the call after using video review. Neymar then angrily punched the ball a short time later as Costa Rica's players tried to waste time. It earned Brazil's biggest star a yellow card.
Neymar seemed panicked for most of the second half as his shots sailed over the bar or simply missed the mark, and he complained over nearly every call. In danger of ending in a draw, Brazil seemed nervous but composed itself through the seven minutes of injury time.
Coutinho was first to get the ball past goalkeeper Keylor Navas. Rising superbly to meet a header from Marcelo's cross, Roberto Firmino nodded the ball down to striker Gabriel Jesus, who then flicked it to a sprinting Coutinho in the penalty area.
In the seventh minute of injury time, Douglas Costa whipped in a cross from the right and Neymar deftly tapped it into the net.
Both Firmino and Costa had come on as substitutes in the second half.
"I think Brazil's changes made an impact," Costa Rica coach Oscar Ramirez said. "It became very difficult for us."
Brazil has four points in Group E and plays Serbia in its final match in Moscow on Wednesday. Costa Rica has zero points and cannot advance.
After a drab and scrappy first half at St. Petersburg Stadium, Brazil came out energized and the chances piled up. Jesus put a header onto the crossbar, and Neymar's hurried shot curled wide.
In Brazil's opening 1-1 draw against Switzerland, Neymar had been fouled 10 times, sometimes harshly. But he was also in theatrical mode against Costa Rica, tumbling over dramatically when touched.
"We never tried to hurt him," Ramirez said. "We tried to play fairly but stop him fairly as well."
Referee Bjorn Kuipers twice waved away Neymar's claims for fouls in the first half. He also ignored a Brazilian claim for a penalty after midfielder Paulinho bounced off defender Oscar Duarte contesting a high ball.
Several players, including Neymar and Marcelo, complained to Kuipers at the end of the first half. Once again, he just waved them away.
The match between Brazil and Serbia in Moscow on Wednesday could yet determine which teams finish in first and second place in Group E.
Costa Rica will play Switzerland on Wednesday in Nizhny Novgorod in its final group match.
KEY TO SUCCESS
With Neymar still short of his best following the foot injury, Brazil once again turned to Coutinho for inspiration.
He was at the heart of Brazil's best moves and kept the tempo going with his crisp passing and darting runs.
Although left back Marcelo had an average game in defense, his constant runs down the flanks ultimately helped when his dangerous cross led to the opening goal.
With his 56th international goal, Neymar is now one ahead of Romario -- which could be a useful omen for Brazil. Romario was the team's top striker when Brazil won the 1994 World Cup in the United States.
Neymar is third on Brazil's all-time scorers' list, behind Pele (77) and Ronaldo (62).