– It began with the magical. It ended with the miraculous.

John Brooks, a 21-year-old German-American who was playing in his first competitive game for the United States and who was on the field only because a starting fullback was hurt, powered a fierce header into the net in the 86th minute Monday to give the U.S. team a 2-1 victory over Ghana in its first match of the tournament.

Afterward, Brooks said that he dreamed nearly the exact situation two nights ago, the only difference being that, in his imagination, he scored in the 80th minute.

“It was my first dream,” he said softly, “hopefully not my last.”

Brooks’ header was the dramatic coda to an evening that opened with exuberance from the Americans after Clint Dempsey scored inside 30 seconds. That was followed by about 80 minutes of nervy, anxious nail-biting as two key U.S. players were lost to injury and the Ghanaians pounded at the United States goal. Then came a few moments of disappointment after Ghana tied the score. And, finally, there was Brooks, rising to meet Graham Zusi’s corner kick.

The Americans still have matches yet to play against Portugal and Germany, but any hope of advancement was predicated on a positive result here. And the United States got one.

“The response after they scored was really good,” midfielder Michael Bradley said. “You looked around and still felt like there was more in it.”

When it was over, coach Jurgen Klinsmann, who had not hesitated to liken this game to a final in terms of its importance, ran onto the field, a smile wide across his face. The Ghana players, aware of how critical three points were, sank to the ground in disbelief.

“The feelings are just incredible,” U.S. defender Matt Besler said.

It was that way from the start. Just moments after the game kicked off, Dempsey, the U.S. captain, saw a pass come his way and let it run, stepping over the ball with his foot before tapping it forward with the inside of his right heel. It was a stylish move, a little bit of class. The ball now in front of him, Dempsey bore in on goal.

One Ghana player ran across him. Then another. Dempsey cut to the inside and, with a quick finish, suddenly stroked the ball past the goalkeeper and in off the inside of the far post as Klinsmann and the entire U.S. bench erupted.

Only 29 seconds had ticked off the clock, making it the fifth-fastest goal in World Cup history.

But most of the rest of the game was maddening for the Americans as Ghana bossed the ball around the field.

Frustration turned to sadness, too, when top striker Jozy Altidore was taken off on a stretcher because of an apparent hamstring injury, his remaining World Cup participation now in doubt.

“I was crushed,” Altidore said. “I knew right away I couldn’t continue. It was the worst feeling.”

Things did not improve as the minutes passed. The Ghanaians, who eliminated the United States in each of the past two World Cups, hammered on the Americans. Kyle Beckerman was floored by an elbow to the head from Mohammed Rabiu (who was cautioned). Dempsey went down, blood pouring from his nose, after taking a shin to the face from John Boye (who was not).

Dempsey played the rest of the game despite struggling to breathe through his nose, saying afterward that he was “coughing up blood a little bit.”

Alejandro Bedoya also looked bothered by a leg injury and so, too, did Besler, one of the two starting central defenders. With Ghana controlling possession and pushing, Klinsmann did not want to risk a gimpy defense; he pulled Besler at halftime as a precaution but did not insert veteran Omar Gonzalez. Instead, he opted for Brooks, one of several dual-national players Klinsmann has recruited.

Brooks played stoutly in defense as the U.S. back line, anchored by goalkeeper Tim Howard, held off the Ghanaians until the 82nd minute. That was when Andre Ayew finished off a pretty passing sequence and beat Howard at the near post from close range.

Deflated as the Americans surely were, they also knew that a tie, earning them a point, was still a good result.

“If you score after just one minute,” Klinsmann said, “you think there can’t be anything better than that.”

But Brooks — dream or not — envisioned more.