Nigeria topped Group B of the Rio 2016 Men's football competition, even though they lost 2-0 to Colombia, who finished second.
The 'Dream Team', as their Under-23 side is called, prior to the last round of group matches had amassed six points from a 5-4 and 1-0 victories against Japan and Sweden respectively.
The other African representatives, Algeria and South Africa, however, have crashed out after placing last in groups D and A respectively.
Hosts Brazil finally found their form to record a comprehensive 4-0 win over Denmark and progress to the quatre finals while holders Mexico and twice winners Argentina were sent packing.
After drab goalless draws in their first two matches, Brazil needed a win to guarantee a place in the last eight, and first-half goals by Gabriel Barbosa and Gabriel Jesus provided a perfect platform.
Luan and Barbosa added two more goals in the second period to carry Brazil to the top of Group A and a Saturday showdown against fellow South Americans Colombia.
Despite the heavy defeat, Denmark advanced to face Nigeria after finishing in second place on four points, while Iraq and South Africa drew 1-1 in the other group game to both be eliminated.
Argentina, Olympic champions in 2004 and 2008, crashed out after a 1-1 draw against Honduras in Group D, as Portugal topped the standings on seven points after a 1-1 draw with Algeria in the other match.
Honduras claimed the second qualifying spot by virtue of a superior goal difference over Argentina, who missed a penalty in their match, with both sides finishing on four points.
Germany were the big winners of the day, hammering 10 goals past Fiji, lifting them to second in Group C above Mexico, who crashed out after Kwon Chang-hoonâ€™s 77th-minute goal gave South Korea a 1-0 win.
The Koreans finished top of the group seven points, ahead of Germany on five. Mexico, who beat Brazil to win the gold in London four years ago, were eliminated along with Fiji.
South Korea will play Honduras in the quarter-finals on Saturday, while Germany face Group D winners Portugal.