Landon Donovan rescued the United States' hopes in the FIFA World Cup with a goal in the 91st minute to defeat Algeria in Pretoria on Wednesday.
Rafik Djebbour hit the crossbar early in the first for Algeria, but the United States (1-0-2) had the lion's share of big chances after that.
Despite that, it was looking like they would finish with three draws, which would have put them out of the tournament.
Instead, the U.S. will next face Ghana in a Round of 16 match Saturday at Royal Bakofeng in Rustenburg (CBC, CBCSports.ca, 2 p.m. ET).
U.S. players on Twitter
Edson Buddle, attacker
- "Today was so surreal!!!! The win feels great! now we must focus on #GHA. Thanks for ur support!!
Landon Donovan, midfielder
- "WOW" :)
Stu Holden, midfielder
- "Trying to wind down after all the excitement today!! Back to work tomorrow and preparing for the big game on SAT!"
Maurice Edu, midfielder
- "Omg! What a game!! Couldn't be more happy n proud!! Never want this feeling to end! I know u guys are with us too!! Let's go! #USA"
Jozy Altidore, attacker
- "We move on!!! crazy game!!! how awesome did that celebration look on tv? lol"
Clint Dempsey thought he scored around the 40th minute, but a borderline offside call was made. Jozy Altidore missed a prime scoring chance late in the half, while Dempsey hit the post and missed on his own rebound early in the second.
Finally, the Americans converted in stoppage time when Donovan swooped in to pick up a rebound goal, one which eliminated Slovenia from the tournament.
The goal came off an Altidore cross, with Algerian keeper Rais M'bohli unable to hold on to the ball as Dempsey came bearing down on him.
"I got the ball to Jozy, who made a good run," Donovan said of the winner. "Clint made a good run in the middle, and the ball came to me — you can't miss from there."
The United States wins Group C on the basis of scoring more goals than England, who finished second.
It is the first time the country has won its group since 1930. It also represented the first time that the Americans have gone past the first round in consecutive World Cups.
Algeria (0-2-1) has never advanced past the first round at the World Cup. They failed to score in their three games, allowing two goals.
U.S. coach Bob Bradley said his team had to take risks, pushing hard for a goal to secure the win and making for a wide open game.
"We're proud," he said. "We finished first in our group. Five points. Didn't lose a match. So we're ready."
Bradley left centre back Oguchi Onyewu on the bench to start the contest at Loftus Versfeld Stadium.
Onyewu was replaced by Jonathan Bornstein while Hercules Gomez came in for suspended striker Robbie Findley. Maurice Edu started in the midfield instead of Jose Torres.
Gomez had a strong chance for the Americans seconds after Algeria hit the bar behind U.S. keeper Tim Howard.
The Algerians made one change from the lineup that started the previoius game against England, bringing on striker Djebbour to lead its attack ahead of Karim Matmour and Karim Ziani.
Djebbour played in Algeria's 1-0 loss to Slovenia but was left out of the lineup against England.
President Bill Clinton attended the game and congratulated the U.S. players in the locker room after the game.