World Cup 2010 - Portugal through after stalemate
Brazil, who secured the point they needed to top the group, were unable to break down a defensively strong Portugal side as the match petered out into a stalemate after an ill-tempered first-half saw seven yellow cards.
Portugal, who extended their unbeaten streak to 19 having gone through the group stage without conceding a goal, will face the winners of Group H in the last 16.
Brazil forward Robinho was surprisingly left out for the five-times champions, who had already qualified for the second round.
But Brazil still had the two clear cut chances of the opening period.
Sevilla striker Luis Fabiano, who scored twice in the 3-1 win over Ivory Coast, headed Maicon's cross just past the post from seven yards.
The first-half saw a flurry of cautions including one for Juan who deliberately handled a long ball intended for Ronaldo just inside his own half.
Portugal were demanding a red card and Duda was booked for protesting; Juan was shown yellow.
Tiago had failed to capitalise on Portugal's best move when he sliced his 20-yard volley wide.
Ill feeling began to creep into the game with Pepe booked for a nasty kick down the Achilles' heel of Felipe Melo who seeked retribution, was cautioned and then substituted by Brazil coach Dunga anxious to keep his full quota of players.
Portugal had the better opportunities of the second-half, Ronaldo's shot flicked off Pepe's heel and looped just over Julio Cesar's crossbar before Raul Meireles spurned their best chance.
Ronaldo broke and lacked support but Lucio's sliding tackle diverted the ball across the face of goal and the midfielder could only stab wide from six yards with his right foot.
On the 28th anniversary of when West Germany and Austria played one of the dullest matches in World Cup history, whistles of derision in the crowd started to echo out and Brazil were resigned to shooting from distance before a couple of late chances.
Ramires's shot was going well wide but hit the back of Bruno Alves and Eduardo had to make a vital save to claw the ball away, before Juan gifted the ball to Danny in injury time but Julio Cesar was bravely off his line to smother the shot.
A chorus of boos greeted the final whistle as the game between two of the top three teams in the FIFA world rankings failed to lived up to the billing.
Portugal v Brazil
1st Half Goals 0-0
Shots on Target 3-5
Shots off Target 8-7
Blocked Shots 3-7
Yellow Cards 4-3
Red Cards 0-0
Passing Success 77.3%-88.8%
Tackles Success 62.5%-50%
Territorial Advantage 38.8%-61.2%