John Brooks rose above the defense and headed it in for a 2-1 victory, putting the U.S. atop the group with Germany.
After Clint Dempsey's historic early goal, the United States spent more than an hour struggling to hold off wave after wave of Ghana attacks. It was no surprise when Ghana tied the game in the 82nd minute.
Once again, the Black Stars — who had eliminated the Americans at the past two World Cups — were poised to ruin the tournament for the U.S.
With two starters out with injuries, the U.S. barely threatened in the second half until a corner kick in the 86th minute. Graham Zusi lifted the ball into the penalty area, where fellow substitute John Brooks rose above the defense and headed it in for a 2-1 victory, putting the U.S. atop the group with Germany.
"I couldn't believe it. ...I just ran in the box and hoped that the ball would hit my head and it did," said Brooks, a 6-foot-4 defender who is brought forward for set pieces.
The loss put Ghana at the bottom of Group G with Portugal — the Americans' next opponent. The top two teams in the group advance.
At the final whistle, coach Jurgen Klinsmann, the German hired to transform the U.S. from mere World Cup participant into a potential power, threw his arms to the sky and roared.
"The U.S. team always has great spirit," Klinsmann said. "I said it to the bench minutes before we're going to get some chances still. So we are still in the game after the equalizer, we just need to kind of push and push and grind it out. That's what they did. Here comes a set piece we trained over and over and over that stuff. And (Brooks) puts it in, so well deserved."
The U.S. lost striker Jozy Altidore to strained left hamstring injury in the 21st minute and his status for the rest of the tournament wasn't immediately known. Dempsey had his nose broken with a knee to the face.
"I was coughing up blood a little bit. Hopefully I'll be able to breathe through my nose again before the next game," Dempsey said.
Dempsey's goal made him the first U.S. player to score in three different World Cups and ranks as the fifth-quickest goal in World Cup history.
Both U.S. goals were surprising. Dempsey's showed the kind of technical flair seldom seen from a squad that typically scores through set pieces. Brooks' game winner rescued the Americans just when the U.S. likely would have been happy to escape with at least a draw.
DaMarcus Beasley, who became the first American to play in four World Cups, started the buildup to Dempsey's goal with a pass to Jermaine Jones, who fed it to Dempsey inside the penalty area.
With a nifty move to split defenders John Boye and Sulley Muntari, Dempsey sent the left-footed shot past goalkeeper Adam Kwarasey, where the ball bounced off the post and in.
The Black Stars regrouped at halftime, and the U.S. looked punchless on the attack. Ghana enjoyed 59 percent of the possession in the game.
Ghana applied relentless pressure on U.S. goalkeeper Tim Howard and finally drew even when captain Asamoah Gyan flicked a backheel pass to Andre Ayew, who used the outside of his left foot for a powerful shot.
Ghana was still pressing when Brooks scored. The 21-year-old who plays for Hertha Berlin in the Bundesliga, appeared shocked, raising his hands to his head before falling to the ground to be mobbed by his teammates.
"It's a special moment for the boy, he did well," Klinsmann said.
"What I can say is it was a very tough game," Ghana coach Kwesi Appiah said. "Playing at this level any little mistake can cost you dearly. We didn't deserve to get the first goal against us."
Under the slogan of "One Nation. One Team", tens of thousands of U.S. fans descended on this coastal city.
While the American fans' chanted "U-S-A!," the constant rhythms and dancing from the smaller Ghana contingent were soon joined by many of the locals who cheered whenever the Black Stars launched an attack.
"We managed to do the hardest part which was to equalize and push. And we take a goal on set pieces. We know that's one of their strong points," Ayew aid. "We played a good game. But you could see USA were hungry, too."