Portugal sealed top spot in World Cup Group D on Wednesday by beating a battling Mexico 2-1 thanks to a Maniche goal and a Simao Sabrosa penalty.
Mexico also made the last 16 after rivals Angola were held to a 1-1 draw by Iran.
Portugal, already qualified and resting five players on yellow cards, held on after taking a 2-0 lead in the first 24 minutes. The Mexicans went down to 10 men in the 61st minute when Luis Perez was sent off for a second yellow card after going down in the box looking for a penalty.
Portugal took the lead in the sixth minute. Maniche supplied Simao Sabrosa, who made a lovely run on the left flank before returning the ball to Maniche to hammer home.
Portugal went two ahead after an inexplicable handball in the box by Mexico's captain Rafael Marquez.
Winger Simao stepped forward to convert it in the 24th minute, stuttering only slightly before hammering the ball past Mexican goalkeeper Oswaldo Sanchez.
Mexico pulled one back five minutes later when Fonseca headed home from a Pavel Pardo corner.
Fonseca almost equalised six minutes before the interval when his head found an Omar Branco cross but this time the ball went just wide.
After the break, Mexico kept up the attack, with Fonseca, who started instead of Guillermo Franco, having a say in most of the attacks.
In the 56th minute, a Pardo cross found Bravo who tapped it to Fonseca, but the shot lacked sufficient power to get past Ricardo.
A minute later, Mexico had a chance to equalise after Miguel touched the ball with his hand in the box, but Bravo's penalty sailed into the crowd.