Spain's shaky group stage campaign finished with a 2-1 win against Chile, securing them the top spot in Group H. Chile still make the last 16, after Switzerland failed to beat Honduras in the evening's other match.
Spain finished the group ahead, but both sides qualify
Friday's last group stage fixtures set up two "international" derby matches in the last 16 - Spain will face neighbors Portugal and Brazil will take on Chile.
Spain beat Chile 2-1 in their last group stage match, coming through to finish top of Group H, even though they haven't really impressed so far in South Africa.
Chile, who again looked strong, go through to the next round despite the defeat, after Switzerland failed to break down the Honduran defense in the group's other game. Had ex-Bayern Munich coach Ottmar Hitzfeld managed to conjure up a win for his Swiss team, they might have pinched the second spot in the last 16.
However, the Swiss team again struggled, and go home having only scored one goal all competition.
Spain still not shining
Chile seemed to be the stronger side in the early going against Spain, creating a host of excellent chances which they could not convert.
But after 24 minutes, some overzealous goalkeeping from Claudio Bravo gifted the lead to the European Champions.
Bravo came charging out of goal to intercept a pass in behind his defense, but his weak clearance went straight to Spanish striker David Villa, who coolly lofted the ball into the open goal from distance.
Shortly before the half, Barcelona's Villa turned provider, setting up playmaker Andres Iniesta for Spain's second. In the run-up to this goal, Chile's Marco Estrada tripped Fernando Torres away from the ball, and the referee awarded him his second yellow card. Chile went two goals, and one man, down in the same instance.
The South Americans started strongly in the second half, and substitute Rodrigo Millar almost immediately pulled one back, when his shot from distance took a hefty deflection on its way to the goal.
The match went off the boil somewhat in the latter stages, even though both sides still created some chances to score.
Brazil and Portugal through
The Brazil Portugal game was hard-fought, but not very pretty
The afternoon Group G game between Brazil and Portugal wasn't the mouth-watering classic one might have expected, but nor was it quite as dull as the 0-0 score suggested.
Both sides pushed forward on occasions, with Portugal the more frequent aggressor, but neither managed to put together any prolonged period of pressure.
The teams were at their most aggressive early on, with the honor of winning Group G still at stake. But the pace of the game dropped considerably in the second half as the two sides appeared to cruise towards the last 16.
From improbable to impossible
In the group's other match, Ivory Coast secured an unsurprising 3-0 win against North Korea.
However, the Africans needed a much more spectacular margin of victory, and - most importantly - they needed Brazil to beat Portugal to have any hope of progressing.
Barcelona's Yaya Toure opened the scoring after just 14 minutes for the Ivory Coast, with a neat side-footed finish from inside the area.
Yaya Toure's goal was exemplary, but he and his team were always fighting a losing battle
Christian Romaric added another moments later, heading home the rebound after Didier Drogba rattled the crossbar as the team chased Portugal's impressive goal difference notched up in the 7-0 rout of North Korea on Monday.
Chelsea's Salomon Kalou grabbed a third in the dying moments, but by then it was clear that his country's World Cup dreams were over.
Before the competition, Ivory Coast were considered perhaps the most exciting African team, with a real chance to go deep into the knockout stages. But, after having the misfortune of drawing a place in the so-called "Group of Death," the team has now fallen at the first hurdle.
Author: Mark Hallam
Editor: Andreas Illmer