The U.S. national soccer team waited four years for this moment, to measure its progress since the last World Cup, to avenge losses against a two-time nemesis and to implement Jurgen Klinsmann’s grand plan.

On an evening of extraordinary turns, of bloodied noses, strained hamstrings and both early and late goals, the Americans claimed a 2-1 victory over Ghana in their Group G opener Monday.

Amid bedlam at Arena das Dunas, substitute John Brooks, 21, scored in the 86th minute — just four minutes after Andre Ayew had canceled out Clint Dempsey’s goal, which came 29 seconds into the match.

Brooks, a 6-foot-4 German American defender who replaced injured Matt Besler at halftime, stung an eight-yard downward header from Graham Zusi’s corner kick past goalkeeper Adam Kwarasey.

He celebrated for a moment, then, perhaps not believing what he had done in just his fifth U.S. appearance, lay on his stomach with his face buried in his arms and the grass for an extended period.

Two days earlier, “I had a dream. I told some teammates I dreamed I scored in the 80th minute and we win the game,” he said. “Now it was the 86th minute, and we won.”

In the dream, he said, “I also scored on a header. . . . It was my first dream [about scoring]. Hopefully not the last.”

The Americans endured hamstring injuries to Jozy Altidore and Besler before halftime, a glaring lack of possession and constant duress to take a considerable step toward the knockout stage.

Two teams from the so-called Group of Death will advance to the round of 16, and the Americans will need at least another point from games against Portugal and Germany to remain in the hunt.

“We know we’ve got a big challenge ahead of us, but it’s a big step,” goalkeeper Tim Howard said. “We put ourselves into a really good position to get through the group.”

Ghana had eliminated the United States in 2006 and 2010, both by 2-1 margins.

Soccer dawned early on this northeast city. Several days of biblical rain gave way to sunshine, drawing streams of visitors to Ponta Negra beach. Vendors opened kiosks on the strand, while push-cart merchants peddled coconuts, crepes and straw hats on the sand. Surfers, joggers, sunbathers and soccer players staked their territory.

See where most World Cup players compete during the rest of the year.

Despite the city’s remoteness, Natal turned into Little USA. Thousands of supporters began arriving two days ago. Flags hung from seaside hotel balconies, and groups gathered at open-air cafes. It looked more like Fourth of July weekend at Ocean City than the buildup to a soccer game.

Long before departing the hotel, the U.S. squad watched Portugal’s 4-0 implosion against group favorite Germany — a thunderous result that opened the door to the Americans or Ghanaians to advance.

The Americans exposed Ghana’s vulnerability in a flash. DaMarcus Beasley played the ball along the sideline to Jermaine Jones, who one-touched to Dempsey rushing through a channel. He toyed with defender John Boye, cutting inside to find a clear path before beating goalkeeper Kwarasey to the far post from eight yards.

In 2010, the Americans had gotten into the terrible habit of conceding early goals. Now it was their turn. Dempsey scored for the third consecutive World Cup, adding to his tallies against Ghana in 2006 and England four years later.

He also became the fifth-fastest goal scorer in World Cup history; at 11 seconds, Turkey’s Hakan Sukur set the mark in the 2002 third-place match.

“In some ways, getting the goal so early throws the game into a tailspin,” midfielder Michael Bradley said. “It’s natural that we start to get drawn back and they start to control a little of the game.”

The Black Stars controlled most of the game but wasted several quality opportunities.

Altidore departed midway through the half with an injury that might sideline him for the rest of the tournament. He will be evaluated upon the squad’s return to its base in Sao Paulo.

With the Americans unable to sustain meaningful possession, the Black Stars continued to mount pressure. They also continued to inflict pain: Dempsey’s nose was bloodied by Boye’s high kick.

The U.S. captain believed his nose was broken. “I was coughing up blood a little bit,” said Dempsey, who played all 90 minutes. “Hopefully I will be able to start breathing through my nose again before the next game.”

U.S. giveaways in the midfield allowed Ghana to continue the attacking assault. With adjustments needed, halftime could not arrive soon enough. Just before the whistle, Ghana squandered a golden chance when Jordan Ayew scuffed a clear shot from the heart of the box.

“We gave them too much of the game,” Klinsmann said.

After the break, Brooks replaced Besler, whose injury was not as serious as Altidore’s.

Sulley Muntari whistled a distant shot past a top corner, and Asamoah Gyan’s clear header missed. Pressure paid off in the 82nd minute when Andre Ayew collected Gyan’s back heel, beat Fabian Johnson and spun a 12-yard shot into the near corner.

Brooks, however, had the final say.

“I was still convinced we were going to win this game even after the equalizer,” Klinsmann said. “I had the feeling that another two, three opportunities would come. And we just need to use one of those.”