Germany, U.S., Algeria through
The United States and Germany reached the knockout stages of the World Cup, with Portugal and Ghana edged out in Group G. Algeria then took the final berth in the knockout rounds by drawing with Russia in Group H.
Germany beat the U.S. 1-0 in soggy conditions as Thomas Muller's 55th-minute goal proved to be enough to take the points and secure top spot.
Germany, playing against their former coach Jurgen Klinsmann -- now in charge of the U.S. -- and several U.S. players born in Germany, were well on top throughout the match and deserved their goal when Muller rifled home a loose ball from just inside the box.
The U.S. rallied late, with Clint Dempsey going close, but the result in the other group game meant they were safe.
Portugal and Ghana will both go home, with the Portuguese unable to win by the required margin to take second. After their crushing defeat to Germany in the first group game, Portugal needed a goal difference swing of five on the U.S. which proved to be too much.
An own goal from John Boye set Paolo Bento's men on their way to the win they needed, before Asamoah Gyan scored an equaliser.
At this stage Ghana knew they only needed one more goal to take second, and Gyan headed wide with a glorious chance when unmarked six yards out.
Cristiano Ronaldo then effectively gave the U.S. extra breathing space when he scored to give Portugal the points, but not the passage to the next round.
The U.S. will now meet Belgium after they beat South Korea 1-0 with ten men to top Group H.
After seeing Steven Defour sent off in the first half following a horror challenge, Belgium sealed South Korea's exit from the 2014 World Cup when Jan Vertonghen netted on 78 minutes.
Belgium scored with 12 minutes remaining as Divock Origi's effort was parried out by Kim Seung-gyu to allow Vertonghen to follow in and tuck home the rebound.
Algeria will meet Germany on Monday after they drew 1-1 with Russia to get out of the group stage for the first time in their history.
It took Russia just six minutes to break the deadlock as Dmitriy Kombarov whipped in a cross from the left and Aleksandr Kokorin headed powerfully past goalkeeper Rais M'Bolhi.
Algeria almost went 2-0 down in the first half when Oleg Shatov's long-range shot whistled past the top corner, before early in the second half Alexander Samedov played a one-two with Kokorin only to see the effort blocked by M'Bolhi.
Algeria equalised on the hour mark as Slimani met Yacine Brahimi's corner, with goalkeeper Igor Akinfeev, who made a poor error in the 1-1 draw with South Korea, caught flapping at the delivery.
Russia pushed for the goal which would have put them through in second but it would not come.