Germany beat the United States to progress as winners of Group G, with the US joining them in the last 16.
A draw would have sent both through regardless of the result between Portugal and Ghana but, in the end, Portugal’s narrow win sent the US through on goal difference.
Thomas Muller gave Germany the lead after the break with a superb measured finish from 18 yards out.
Jurgen Klinsmann’s side were always in the contest but rarely threatened.
Meanwhile, Cristiano Ronaldo scored a second-half winner for Portugal against Ghana but it was not enough to secure a place in the last-16 of the World Cup.
Ghana defender John Boye gifted Portugal the lead when he turned a cross into his own net, but Asamoah Gyan headed in an equaliser.
Ronaldo capitalised on a poor clearance to sweep home and give Portugal hope, reports the BBC.
But they could not find the three more goals they needed to take second, which went to USA on goal difference.