Neymar and Brazil get it done — at the end. (Carlos Garcia Rawlins/Reuters)

ST. PETERSBURG — At the summer solstice, with the dipping sun stopping short of the horizon and failing to fully darken this luminescent northern city, residents and visitors alike enjoy weeks of what is known as the White Nights.

Endless days invite nonstop activity, in the pretty parks and along the Neva River and Baltic Sea.

What better time and setting for the Brazilian masses, soccer revelers of unparalleled endurance, followers of the famed Selecao, worshipers of the sun wrapped in beautiful bright yellow?

And so Friday they came to this lovely corner of Europe — and fretted and fumed and fussed while a laborious match against Costa Rica unfolded before two goals in second-half stoppage time defused the tension and produced a 2-0 victory.


Want smart analysis, opinions, viewing guides and more from the World Cup? Sign up for our month-long newsletter. Every match day through the final July 15.


Philippe Coutinho’s go-ahead goal brought such profound relief that Coach Tite charged onto the field and tumbled to the turf.

“It tore some fibers,” he said, smiling. “I’m limping.”

The pain — and the wait — was worth it. Brazil responded from an uneven performance in a 1-1 draw with Switzerland on Sunday and an underwhelming display in the first half Friday to close in on a spot in the round of 16 from Group E.

Tite was not the only one to release his emotions. Neymar, the star attacker seeking to regain world-class form after foot surgery sidelined him much of the year, dropped to his knees at the final whistle, covered his face and shed tears. He had put the outcome to rest with a goal in the final seconds.

“The joy, the satisfaction and the pride of representing the Brazilian national team is a lot,” Tite said. “He has the responsibility and pressure and courage to show it. Everyone shows it in their own way.”

With their team needing nearly every last second to earn the expected three points, Brazilian fans rode a wave of emotions all afternoon. Costa Rica, which will not advance after reaching the quarterfinals in 2014, threatened to take the lead in the first half before Brazil found its way after halftime.

Tite “always highlights the importance of being mentally strong from the beginning,” Coutinho said. “Whether you score in the first minute or the last minute, you have to fight. We fought to the end. We were rewarded with the victory.”

You got the sense watching Brazil in the second half that things are beginning to fall into place. Neymar is getting stronger, and the chemistry is improving. While Germany and Argentina have struggled, Brazil looks as if it is building toward a championship run.

“I see the team consolidating and growing,” Tite said. “Sometimes the players build their own spirit. I have to look to foster that growth and strengthen the team.”

Early on, though, Costa Rica identified gaps in the Brazilian formation and generated opportunities both from counterattacks and possession. The best: Celso Borges’s running one-timer, a clear bid from 14 yards, that streaked beyond the far post.

The Brazilians roared to life after intermission, lifted in part by the arrival of Douglas Costa and the departure of Willian, who logged 45 lousy minutes.

“I joked, ‘Look at the old man, 57 years old. Please control the ball and make opportunities,’ ” Tite said.

They responded. Gabriel Jesus’s header kissed the crossbar, and Costa Rica defender Cristian Gamboa blocked Coutinho’s bid. Unmarked in the heart of the penalty area, Neymar drove a one-timer over the crossbar.

Brazilian frustration grew. At one point, after a player joust, Dutch referee Bjorn Kuipers gestured to Neymar to shut his mouth.

The Ticos were consumed with absorbing pressure and counterattacking, the only way they were going to survive.

From a tactical standpoint, there was nothing for them to be ashamed about (until the last 10 minutes, anyway, when they stalled and embellished injuries). It was smart, patient soccer that turned the majority Brazilian audience into a nervous wreck.

Ticos Coach Oscar Ramirez said: “I don’t know what else we could’ve done. What we did was perfect. Considering what I had at my disposal and what they had, it was reasonable what we did.”

Neymar had another great look, whistling a 22-yarder past the top right corner. With nothing going his way, he turned to trickery, tipping over like a rotting tree when Giancarlo Gonzalez made light contact in the box.

Kuipers awarded a penalty kick, but video replay took it away.

“Brazil doesn’t need any help,” Tite said. “The athletes don’t want any help. The coach doesn’t need any help. We want to be better — that’s how we want to win.”

Playing better did not translate into goals. Irritation grew. Costa Rica’s Keylor Navas, Real Madrid’s primary goalkeeper, did not make any mistakes.

Then came the breakthrough. Roberto Firmino won a header in the box. Jesus left the ball for Coutinho, who stabbed in a one-timer.

Later, Neymar knocked in Costa’s cross to clinch the outcome — and provide late-arriving relief for the band of Brazilian supporters.

“He is a human being,” Tite said of the superstar. “He needs time to resume his high standards. While he is doing that, the team has to be strong and not dependent on him. Is he going to make it? Yes, of course, he’s going to make it. He’s going to reach the top. You will see.”

— Steven Goff

***

What’s next 

Brazil: vs. Serbia in Moscow, June 27, 2 p.m.

Costa Rica: vs. Switzerland in Nizhny-Novgorod, June 27, 2 p.m.

***

Game highlights

Goal!

It’s the dagger for Brazil in the 97th minute as Costa finds Neymar for a much-earned goal, just before the end. This’ll end 2-0. Neymar is in tears after the whistle.

Goal!

Coutinho collects the ball in the box after a tip from Jesus and Navas can’t stop this one in the 91st minute. Brazil is up 1-0 and the celebration suggests a much bigger win than a World Cup group-stage match.

Down goes Tite!

He almost did it again about three minutes later, but his close-in shot is high and wide.

Penalty shot overturned!

At long last, after much politicking, Neymar gets a call as he’s dragged down by Gonzales in the box. Dutch referee Bjorn Kuipers goes to the video to make sure Neymar wasn’t embellishing and . . . he overturns his own call! (Neymar gave it an overly dramatic sell, yes.)

In the 81st minute, Neymar slams the ball to the turf during a stoppage in play and gets the yellow. Coutinho got one, too. The boiling point has been reached.

Kuipers should not expect a Christmas card from Neymar this year. Or, frankly, from anyone in Brazil.

Ticos done with subs

Costa Rica makes a second substitution in the 75th minute as Francisco Calvo comes on for Cristian Gamboa. In the 83rd minute, Yeltsin Tejeda comes on for David Guzman.

Brazil’s second sub

Roberto Firmino enters for Paulinho, in the 67th minute. Moments later, Casimiro’s header off a corner kick is straight at Navas.

Then, with space to roam after a Costa Rican attempt is halted and a bad Tico touch gives the ball away, Neymar’s attempt from 25 yards goes inches right. He had Navas beat, but the aim was just wide.

Costa Rica shakes things up

Christian Bolanos, becoming the first Costa Rican to appear in three World Cups, comes on to replace Marco Urena.

So. Many. Chances.

Brazil is getting right to it, first by batting the ball around the box. Navas took a knee to the midsection from Neymar as he corralled the ball. He seemed to be at least momentarily in pain.

Then, moments later, Jesus had Navas beaten but not the post. His header bangs off — and Coutinho’s strike on the rebound is booted away by Navas — and we remain scoreless.

A change for Brazil

Willian is off, Douglas Costa is on for Brazil as we begin the second half.

Halftime: 0-0

Brazil is controlling possession (around 65 percent) but hasn’t been able to piece together a truly strong scoring chance. Costa Rica had a few minor chances to get numbers on the counterattack but they didn’t have much urgency behind them.

A number of Costa Rica’s fouls have been committed on Neymar — hey, it seems to be the thing to do — and he had some words for Dutch referee Bjorn Kuipers before getting pulled away by his teammates as he was heading to the locker room.

Ticos simply holding on

Costa Rica, in its rare forays with possession, seems content to tinker with the ball at midfield until Brazil inevitably takes it away. Just seems like they’re trying to stem the tide right now.

No goal!

Marcelo appears to score in the 26th minute but the offside flag was up. No goal. Proper call. Moments later, Neymar has a run in but Navas breaks it up. Brazil, particularly Neymar, starting to buzz here with runs down the left side. Marcelo sends a shot just wide in the 29th minute.

Neymar fouled again. And Again.

In the 15th minute, the oft-fouled Neymar gets his foot stepped on during a challenge by David Guzman. He’s down but then up. It’s his left foot, not the troublesome right. Two minutes later, he’s fouled again by Johan Venegas after a nifty move.

Seven fouls for Costa Rica in the first 23 minutes.

Casemiro trying to stop the bleeding

Casemiro took a ball to the nose and had to come off to stop the bleeding. With Brazil down to 10 men, Costa Rica pushes forward and Celso Borges sends a good attempt on to Alisson. It goes just wide.

Remember Fagner’s celebration?

Fagner has had the ball on his feet a few times already in his first-ever World Cup match. Remember when he found out he made the team in May? Good stuff here:

Opening thoughts

Both teams carry an air of unease into their second group-stage match. Brazil has had to spend the days since its opening draw with Switzerland answering questions about its subpar performance and injury concerns about Neymar. Costa Rica, meanwhile, has been roiled by alleged intrasquad tiffs: According to the Tico Times, an apparent practice argument between players Johan Venegas and Giancarlo González was broadcast on a live feed before it was taken down. Meanwhile, the players perhaps are unhappy with Coach Oscar Ramírez and allegedly feel like star goalkeeper Keylor Navas isn’t being the best teammate. With Brazil on tap, none of that can be seen as ideal. Costa Rica needs at least a draw to keep its knockout-round hopes alive.

Brazil is now on a three-game winless streak at the World Cup, dating to 2014. The last time they went four games without a win: 1974-78.

The lineups

Brazil: Alisson; Silva, Miranda, Marcelo, Fagner; Casemiro, Coutinho, Paulinho, Willian; Jesus, Neymar

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

Of note: Yes, Neymar is in the starting 11 for Brazil, which also is replacing an injured Danilo with Fagner (making his first-ever World Cup appearance and playing in only his fifth-ever international game). Costa Rica slots in Bryan Oviedo for Francisco Calvo.

— Matt Bonesteel

Read more about the World Cup:

Australia stays alive with 1-1 draw against Denmark

France puts an end to Peru’s grand ambitions

Goff: What’s it really like in Russia? During the World Cup, more vibrant than I expected.

FIFA clears U.S. referee after allegation he asked for Portugal World Cup jersey