Brazil finished top of the section with seven points with Portugal in second place on five. Ivory Coast beat North Korea 3-0 in the other game in Nelspruit but it was not enough.
The match, one of the most eagerly-awaited of the first round, was a huge disappointment with neither team prepared to take risks and was marred by petulant behaviour on both sides.
"It was a difficult game. They started very strongly, we had to put on our working overalls but I think we left the match wearing a smoking jacket," said Portugal coach Carlos Queiroz.
"There was a fantastic attitude from all the Portugal players. They were great in how they tried to play their football and how they fought," he added.
Brazil captain Lucio, asked about the many fouls, added: "We know both teams had a lot of will to win and went in with a lot of determination and so it happens, one or more severe tackles.
"I think our team tried to play a little more. We knew it would be like that as both teams were qualified."
THREE CHANGES
Portugal, needing a point to make absolutely sure of a place in the last 16, made three changes from the team that thrashed North Korea 7-0 in their last group match.
Defenders Duda and Ricardo Costa were brought into the starting eleven along with forward Danny, replacing Pedro Mendes, Hugo Almeida and Simao Sabrosa.
Brazil replaced Robinho with Nilmar in their lineup while Julio Baptista stood in for the suspended Kaka in midfield.
The flurry of bookings in a bad-tempered first period included Brazil midfielder Felipe Melo, hauled off just before halftime by coach Dunga and replaced by Josue as his duel with Pepe -- also yellow carded -- threatened to boil over.
There were only three efforts on target before the break as both teams cancelled each other out.
The best first-half chances fell to Nilmar, who had his close-range effort tipped onto the post by Eduardo after a cross by Maicon and then saw a downward header from another Maicon cross bounce just wide of the goal.
Tempers calmed down after the break with Portugal looking the sharper and substitute Simao Sabrosa forced Brazil goalkeeper Julio Cesar to make a tricky save from a long-range effort at the second attempt.
Portugal should have gone ahead soon after when Cristiano Ronaldo's run ended with the ball falling to Raul Meireles but his close-range effort was saved by Cesar who dived bravely to turn the ball around the post and was hurt in the process.
Brazil were without suspended playmaker Kaka and forward Robinho, who was rested as the five-times world champions were already sure of their place in the last 16.