Javier Hernandez scored twice as well as missing a penalty as Mexico beat Japan to finish third in Group A of the Confederations Cup in Belo Horizonte.
The Manchester United striker headed home twice in the second half after Mexico recovered from a miserable first 45 minutes when they produced nothing of note in front of goal.
Japan pulled a goal back through Shinji Okazaki with five minutes left but Hernandez squandered the chance of claiming a hat-trick when his injury-time penalty was saved.
It leaves Mexico third in the group with three points but Japan leave Brazil without a point after three defeats.
Japan had the first goalscoring chance of the match when Shinji Kagawa wriggled through close attention from the Mexico defence and poked the ball towards goal with goalkeeper Francisco Ochoa saving with his foot.
Japan had the ball in the net in the ninth minute but Okazaki was offside when he backheeled the ball into the goal before the striker's determined run in to the box ended with him poking the ball wide.
Mexico had been decidedly second best in the opening stages and Japan fashioned another opening only for Keisuke Honda to fire at the keeper from just outside the area.
Ochoa plucked the ball out of the air as Ryoichi Maeda arrived and Honda's long-range effort was thwarted but it was Mexico who came within inches of scoring the opener in the 40th minute when an unmarked Andres Guardado hit the post with a diving header in front of goal with Japan goalkeeper Eiji Kawashima beaten.
Kawashima then punched Jesus Zavala's shot away in the last action of the first half.
Mexico improved markedly at the start of the second half and Japan had to be grateful to Kawashima, who parried Zavala's firm header on the line.
However, Jose Manuel de la Torre's side took the lead in the 54th minute. Guardado swung in a curling cross from the left which found Hernandez, who had got behind the defender and made no mistake heading home.
Kawashima then tipped Dos Santos' shot round the post before Maeda was inches wide with a drilled shot from distance at the other end.
Mexico though doubled their lead 24 minutes from time when Hernandez moved away from his defender to nod home following Hiram Mier's flick-on from Dos Santos' corner.
Dos Santos was a constant menace and the keeper took no chances with the striker's curling effort after cutting in from the left.
However, Japan got a goal back five minutes from time when Yasuhito Endo's first-time pass found Okazaki in front of goal and he fired the ball home off the underside of the bar.
Five minutes injury time were indicated and in the first Mexico were awarded a penalty when Hernandez went down after tangling with Atsuto Uchida.
Hernandez took the penalty himself but Kawashima guessed correctly to his right, with the Manchester United striker then firing the rebound against the bar.
However, Japan could not fashion an opening and Mexico secured victory.