(CNN) -

Mission accomplished -- Team USA booked its place in the last-16 of the World Cup after escaping from one of the tournament's toughest groups.

Jurgen Klinsmann's men slumped to a 1-0 defeat by Germany in Thursday's final Group G game but still qualified despite Portugal defeating Ghana 2-1.

Thomas Muller's second-half strike condemned the U.S. to defeat following a rain-soaked contest in Recife.

But Cristiano Ronaldo's late strike for Portugal inflicted defeat on Ghana and ensured the Americans qualified in second place on goal difference.

The U.S. will now travel to Salvador where its opponent will be Belgium on Tuesday, while Germany will face Algeria on Monday.

For Klinsmann, a man who won the 1990 World Cup as a player with West Germany and coached the national side to the semifinals in 2006, this was always going to be an emotional occasion.

Sitting on the U.S. bench just meters away from his old friend Joachim Low, the man who worked as his assistant eight years ago, the game had plots and sub-plots galore.

"We created too few chances, but it's still fantastic to go through," Klinsmann said.

"Everybody said we had no chance, but we've taken it and we're now in the last 16."

Any friendship or sentimentality was soon forgotten as the two teams went toe-to-toe in a heavyweight battle.

Played in monsoon-like conditions, both sets of players struggled to find any rhythm in the first half.

The buildup to the game was disrupted by heavy rain in Recife which left fans wading through flooded roads on the way to the stadium.

Traffic was brought to a standstill by floodwaters while family members of the U.S. team were unable to attend because of the adverse weather conditions.

Germany, which thrashed Portugal 4-0 in its opening game before being held 2-2 by Ghana, began in confident fashion and dominated possession.

But Team USA, marshaled by the impressive Omar Gonzalez, looked more than comfortable as the rain continued to lash down.

Despite being forced to sit back and soak up pressure early on, it was the U.S. which created the opening chance of the first half when Graham Zusi sent a curling effort just over the crossbar.

Germany, playing without a recognized striker, enjoyed plenty of possession in front of the U.S. defense but rarely managed to find a way through.

And when it did, goalkeeper Tim Howard was on hand to ensure Mesut Ozil's effort was blocked, after the Arsenal player momentarily eluded his marker.

Germany changed tactics after the interval with the introduction of veteran striker Miroslav Klose -- the man who stands joint-top in the World Cup goalscorers' chart with 15 to his name.

And it was the 36-year-old who almost made the breakthrough just minutes after interval but could only plant his header wide after meeting Muller's cross.