(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 from a corner kick just four minutes after Andre Ayew of Ghana equalized 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 U.S. in a World Cup match.
He netted just 29 seconds into the match, breaking into the penalty area and striking home a left-footed shot past sprawling Ghana goalkeeper Adam Kwarasey. It was the fifth fastest goal in World Cup history.
"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."
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.
Ayew finished neatly with the outside of his left boot after a flowing move that saw him collect a back heel from striker Asamoah Gyan.
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.