Brazil strolled into the second round with an impressive win as Costa Rica crashed out of the competition in Suwon.
The four-time world champions played their mesmeric attacking football to the constant beat of samba drums as they cruised through to the knockout stage unbeaten.
Both sides squandered plenty of chances in a thrilling attack-minded contest - the most open match of the tournament to date.
But Brazil never really had to employ top gear and goals from Ronaldo, Edmilson, Rivaldo, Junior and a Luis Marin own goal set up a meeting with the runners-up from Group H.
Despite the scoreline, Costa Rica enjoyed their share of the game in front of a flimsy Brazilian defence but - needing only a draw to progress - found finishing more difficult.
Goals from Paulo Wanchope and Ronald Gomez either side of the break were not enough to take them second in the group as Turkey beat China 3-0 to send coach Alexandre Guimaraes' side home.
Brazil settled quickly into their familiar dawdling-assassin mode and quickly punished Costa Rica's seventh-minute header over the bar from Mauricio Wright.
Edilson set off on a jinking run down the inside left channel and squared for Ronaldo to bundle the ball in via Costa Rica's Marin who was credited with an own goal.
Minutes later, Edilson's left-sided corner was converted at the near post by Ronaldo after a quick goalmouth scramble.
To their credit the Central Americans began to exert some pressure of their own to keep the floodgates closed for a while longer.
But Walter Centeno, Wright and Gomez all squandered clear-cut chances in front of goal.
Brazil had been happy to sit back and watch but suddenly came to life when defender Edmilson sealed a flowing move down the left with a spectacular overhead goal.
Despite Brazil's obvious skill in attack their defence was not as awe-inspiring and Wanchope was allowed to score a minute later after a neat one-two with Wright.
But Brazil were desperately close to adding a fourth before the break, after Rivaldo missed an open goal from Ronaldo's cross.
He then saw an ensuing free-kick hit the post before the rebound was blasted just wide.
Ronaldo claimed Brazil's second goal
After the break Ronaldo gave the slightest hint he is not yet back to his best when he wasted a one-on-one with Costa Rica goalkeeper Erick Lonnis.
Soon after he blasted a second chance into the stratosphere.
Costa Rica took heart and went close through Wanchope, who had a shot cleared off the line, and Carlos Castro, who saw his shot tipped over the bar.
But still they came and Gomez finally hit the back of the net with a diving header off Steven Bryce's cross.
Brazil's brief lapse was soon put behind them as Rivaldo scored from Junior's cross from the left - before Junior himself fired home at the near post.
But defence was still not Brazil's strong point and keeper Marcos was forced into a good save before his right-hand post kept out Costa Rica after Junior's slashed clearance was heading goalwards.
Costa Rica continued to surge forward and borrowed from the Brazilians in some of their link-up play.
But finishing was a problem and Rolando Fonseca dragged a good chance wide on 77 minutes.
Brazil looked to have had their fill of attacking but Ronaldo hit the post inside the last eight minutes.
The woodwork was then hit at the other end, Wanchope striking the bar as goalkeeper Marcos clutched his injured head.
Costa Rica had plenty of opportunities to claw back their goal difference on Turkey - but Brazil were always at least one step ahead.
Costa Rica: Lonnis, Marin, Wright, Martinez (Parks 73), Castro, Wallace (Bryce 46), Lopez, Solis (Fonseca 66), Centeno, Gomez, Wanchope.
Subs Not Used: Chinchilla, Cordero, Drummond, Medford, Mesen, Morgan, Rodriguez, Sunsing, Vallejos.
Brazil: Marcos, Cafu, Lucio, Edmilson, Polga, Junior, Juninho Paulista (Ricardinho 60), Gilberto, Rivaldo (Kaka 72), Ronaldo, Edilson (Kleberson 58).
Subs Not Used: Belleti, Carlos, Ceni, Denilson, Dida, Luizao, Ronaldinho, Roque Junior, Vampeta.
Referee: Gamal Ghandour (Egypt)
MATCH STATS |
| Costa R | Brazil |
Corners (1st half) | 8 | 4 |
Corners (2nd half) | 6 | 2 |
Fouls committed | 13 | 6 |
Caught offside | 3 | 9 |
Shots on target | 9 | 6 |
Shots off target | 10 | 8 |
Hit woodwork (back into play) | 1 | 2 |
Yellow cards | 0 | 1 |
Red cards | 0 | 0 |
STOPPAGE TIME | |
First half - 2 mins | Second half - 4 mins |