The United States needed two late goals, including a stoppage time winner, to beat El Salvador 2-1 in a friendly international on Wednesday.
The World Cup-bound Americans, playing without many of the players who are likely to feature in South Africa later this year, went a goal down when a defensive error allowed Rudis Corales to score in the 59th mianute.
Substitute striker Brian Ching headed home the equaliser 16 minutes later before midfielder Sacha Kljestan snatched the winner in stoppage time with a fine solo effort.
The US will next be in action in a friendly against the Netherlands on March 3.
The Americans are in Group C with England, Algeria and Slovenia for the first round of the June 11-July 11 tournament and open their campaign against the English on June 12.
Amla's double ton puts SA in control
United States making progress, says Arena
Follow, discuss the India-South Africa first Test
Brazil whip up storm to thrash US
Follow, discuss the India-South Africa second Test