Mix Diskerud and Aron Johannsson came off the bench to score late goals to lift Jurgen Klinsmann's side over the European nation.
The U.S. dominated the European team throughout the full 90 minutes and finally found the net after substitute Mix Diskerud scored off a rebound in the 75th minute. Aron Johannsson, who also came on in the second half, put the American up two six minutes later.
MORE: Best pictures from USA friendly
Klinsmann named his 23-man party for the finals in Brazil last week, with veteran forward Landon Donovan controversially left out. But the German coach can rest easy with his decision for at least a few days after his late subs saved the U.S. from an embarrassing draw.
Klinsmann used an experienced starting XI and all six available substitutions to get a feel for the squad. However, he was without captain Clint Dempsey, who was a late scratch with a groin injury. The severity of the strain was unknown, but he should be available for the next game.
The U.S. is set to meet Turkey in Harrison, New Jersey, on Sunday. The team will host Nigeria the following week in Jacksonville, Florida, before opening the World Cup against Ghana on June 16.
The U.S. could have used Dempsey (the highest-scoring American to ever play in Europe) and even Donovan (MLS's all-time top goal scorer) early on against Azerbaijan. For a majority of the match the 85th-ranked team held its own on defense against the 14th-ranked Americans.
But that all changed after the subs entered the game.
Diskerud, wearing Donovan's No. 10 jersey, came on for Alejandro Bedoya in the 71st minute and he did not take long to make a difference. Being in the right place at the right time, the midfielder knocked in a rebound after Michael Bradley's shot was saved by defender Elvin Yunuszada.
Moments later, Johannsson found himself wide open as Brad Davis sent in a perfectly placed corner kick, and the AZ Alkmaar striker headed the ball past Kamran Agayev.
Johannsson had replaced Chris Wondolowski up front in the 62nd minute. Both strikers made impacts, with Wondolowski barely missing on two headers in the first 15 minutes of the match.