(CNN) -- Substitute John Brooks' headed goal four minutes from time gave the United States a dramatic 2-1 victory over Ghana in a Group G opening round World Cup match on Monday.
Brooks scored on a corner kick just four minutes after Andre Ayew of Ghana equalized the game by giving Ghana the goal that had eluded its grasp much of the night.
Clint Dempsey had given the United States a 1-0 lead with the quickest goal ever for the United States in a World Cup match. He netted just 30 seconds into the match, breaking into the penalty area and striking home a left-footed shot past sprawling Ghana goalkeeper Adam Kwarasey.
"We have a great spirit and (we) fight until the last second," U.S. coach Jurgen Klinsmann said. "There is undoubtedly things that we need to improve. At the end of the day we got the three points."
WATCH: Game-winning goal moment at Power and Light, courtesy of Sporting Kansas City:
The 2-1 scoreline was familiar but a turnaround from the 2006 and 2010 World Cups when Ghana eliminated the United States each time by the same score.
After a frustrating first half, Ghana threatened more often in the second 45 minutes, finally getting the goal that seemed would be their destiny eight minutes from the end.
The favored Ghanaians spent much of the game in the U.S. end. They often knocked the ball around as the Americans sat back on defense, trying not to be beaten by the Africans' speed.
Ghana, the youngest team in the tournament, attacked incessantly down the right side of the field in the first half, only to be undone by poor crosses that sailed high and wide.
The United States chose to rely on counterattacks and in the 19th minute almost doubled its 1-0 lead when striker Jozy Altidore had a good chance that was thwarted by a sliding defender.
It was heartbreak for the young American, who left the match with a hamstring injury two minutes later. He was replaced by Aron Johansson.
The Americans spent much of the second half chasing the ball and only mustered a Dempsey shot in the 79th minute that was easily saved by Kwarasey until Brooks' stunning goal, his first in an international match.
U.S. goalie Tim Howard had four saves. Kwarasey had three.
The United States faces Portugal on Sunday, while Ghana plays Germany on Saturday.