The United States lost 1-0 to Germany in Thursday's group-stage finale, but still progressed to the knockout stage of the World Cup thanks to Portugal's 2-1 victory over Ghana.
Thomas Muller's 55th-minute strike from outside the box gave Germany a lead that stood through full time. Only when Cristiano Ronaldo scored a late winner for Portugal to break a 1-1 deadlock could American fans exhale: A U.S. loss paired with a Ghana victory would have spelled elimination.
The U.S. advances to a Round of 16 match at Salvador's Arena Fonte Nova on Tuesday at 4 p.m. ET, most likely against Belgium, current frontrunners in Group H.
If South Korea beats Belgium and Algeria defeats Russia in Thursday's later matches, the United States will face Algeria.
"It's huge for us getting out of this group, no one said we had a chance," U.S. coach Jurgen Klinsmann said after the final whistle. "Now we really want to prove a point."
Both the U.S. and Portugal finished tied for second place in Group G, but the Americans held the tie-breaker on goal difference.