RECIFE, Brazil — Joachim Loew and Jurgen Klinsmann shook hands, smiled and patted each on the shoulders, like the two good friends they are. The two coaches had every reason to be pleased: both of their teams advanced to the knockout stage of the World Cup.

Loew's Germany beat Klinsmann's United States 1-0 thanks to Thomas Mueller's fourth goal of the tournament and the outcome allowed both teams to advance. Portugal beat Ghana 2-1 in the other Group G match but both were eliminated.

A draw would have been enough as well, and it had been the matter of much conjecture before Thursday's match at the rain drenched Arena Pernambuco. But neither team held back and both attacked, although Germany was clearly in control.

"Well, first I asked him (Klinsmann) for the result of the other match. I didn't know that and he also told me they advanced and I told him, I'm happy," Loew said.

"That is a tough group and the Americans were a bit the outsiders. Everybody considered Portugal a favorite to make it. ... (The Americans) really have qualities, they fight, they can run and they really are tough on the opponent. If you beat Ghana, play a draw against Portugal, I think you deserve to make it to the next round."

Germany, a three-time champion, now travels to Porto Alegre to play Algeria, the runner-up in Group H on June 30. The Americans play the winner of that group — Belgium — on July 1 in Salvador.

"It's a good feeling because now it's really just a clear picture for everyone. Just focus on that one opponent you have for that next game. ... We'll just talk about one team to beat at a time and this is why I'm really excited" about this next phase, Klinsmann said.

Klinsmann was Loew's predecessor and made him his assistant, until Klinsmann quit following Germany's third-place finish at the 2006 World Cup at home. Loew then took over and is still looking for his first major title.

Klinsmann also warmly embraced Germany players, some of whom got their start under him. Mueller got his Bundesliga debut in August 2008 when Klinsmann was the coach of Bayern Munich.

Klinsmann must have had a good nose for talent, since Mueller is on track to retain his Golden Boot title by scoring his fourth goal of the tournament, to go with five he had in 2010.

Germany's goal came in the 55th minute after a corner by Mesut Ozil. U.S. goalkeeper Tim Howard did well to punch out a header by Per Mertesacker but pushed the ball into the path of Mueller, who rifled a shot inside the far post from the edge of the penalty area.

"We clearly dominated the match and we played not a bad game against a top-fit American team," Mueller said. "I finally scored a pretty goal. I manage it every now and then. We're all terribly ambitious and this ambition can take us very far and I try to give my part in each and every match."

Page 2 of 2 - Mueller played despite needing five stiches to close a cut above his right eye sustained in the 2-2 draw with Ghana on Saturday and still visible five days later.

The United States had a chance to level the match in stoppage time, but Alejandro Bedoya's low shot inside the box was swept away by the sliding Mario Goetze, a late substitute. The Americans won a corner but Clint Dempsey's header at the far post went high.

"We knew it would be a difficult match today. We were ready for that. We controlled the match and did not allow any chances until late in the match," Loew said. "We failed to score a second goal that would have settled the issue earlier."