Brazil striker Ronaldo became the joint highest scorer in World Cup history as he scored twice against Japan.
Ronaldo moved two clear of Pele's World Cup finals tally
The 29-year-old headed in an equaliser before half-time to go past Pele and then curled in his 14th finals goal at the end to go level with Gerd Muller.
Japan went ahead through Keiji Tamada's left-foot drive but Brazil took control through Ronaldo, Juninho Pernambucano's 30-yarder and Gilberto's sweet strike.
Ronaldo wrapped it up and the Group F winners now play Ghana in the last 16.
In the process, Brazil made it 10 consecutive wins at World Cup finals and they finally produced the sort of free-flowing football their fans have been waiting for.
They went into the game under a different sort of pressure - they had already qualified but had come under heavy criticism for a lack of flair in their performances.
No-one had suffered more than Ronaldo. Branded overweight and unfit, the top scorer at the 2002 World Cup was perhaps only one game away from being dropped.
He needed a goal and nearly got it straight away, producing a trademark shimmy to create space - only to see Yoshikatsu Kawaguchi make a fine save.
Kawaguchi was in for a busy night. Twice Robinho tested him, once with a left-foot snap-shot, then with a curler after a majestically mazy run.
He pulled off a blinder to deny Ronaldo and then made the save of the tournament to almost unbelievably tip over a thunderous Juninho drive from 20 yards.
Just when it seemed a matter of time until Brazil scored, they were hit by a brilliant Japan counter-attack.
Alex found some space on the left and slipped in a lovely ball to Tamada, who took a touch and hammered a stunning left-footer into the top corner of Dida's net.
But, with almost the last touch of the half, Ronaldo buried his demons, heading in from close-range after Cicinho nodded Ronaldinho's centre back across goal.
He should have scored again just after the break following an exquisite one-two with Ronaldinho on the edge of the area but could only guide a right-foot shot inches wide from 16 yards.
Ronaldo heads past Kawaguchi to equalise for Brazil
It did not take Brazil much longer to go ahead and it was a horror moment for the previously outstanding Kawaguchi.
Juninho hit a hopeful shot from 30 yards that swung and dipped and deceived Kawaguchi as it went through the stopper's attempted save.
It was party time for the Brazilians and they wrapped up the points when Ronaldinho fed Gilberto and the 30-year-old skilfully drilled home a left-foot shot from a tight angle.
Ronaldo was not finished yet though - and he saved the best until last in Dortmund.
Taking a pass from Robinho, he superbly manoeuvred some space before side-footing brilliantly into the far corner from outside the area.
Brazil, and their star striker, have finally arrived at the 2006 World Cup.
Japan: Kawaguchi, Santos, Tsuboi, Kaji, Nakazawa, Hidetoshi Nakata, Ogasawara (Koji Nakata 56), Nakamura, Inamoto, Maki (Takahara 60), Tamada, Takahara (Oguro 66).
Subs Not Used: Doi, Endo, Fukunishi, Komano, Moniwa, Narazaki, Ono, Yanagisawa.
Goals: Tamada 33.
Brazil: Dida (Rogerio 82), Lucio, Juan, Cicinho, Gilberto, Kaka (Ze Roberto 71), Ronaldinho (Ricardinho 71), Silva, Juninho, Ronaldo, Robinho.
Subs Not Used: Adriano, Cafu, Carlos, Cris, Emerson, Fred, Julio Cesar, Luisao, Mineiro.
Goals: Ronaldo 45, Juninho 53, Gilberto 59, Ronaldo 81.
Ref: Eric Poulat (France).
Fifa man of match: Ronaldo
Brazil won all three group matches, a feat they also achieved in 1970, 1982, 1986, 1990 and 2002. Keiji Tamada's 34th minute goal for Japan smashed Brazil's record breaking streak of 461 minutes without conceding.
Ronaldo scored his 13th and 14th World Cup goals to equal the all-time record of 14 by West Germany's Gerd Muller. It also meant that he has scored at three different World Cups and is the 20th player to do so. Ronaldo played his 17th successive World Cup match, the longest streak by a current player.
No Asian nation has beaten a South American country at the World Cup in four attempts. Japan's Hidetoshi Nakata became the first Japanese player and seventh Asian to play 10 World Cup matches.