BELO HORIZONTE, Brazil (AP) — Javier Hernandez cemented his status as Mexico's leading striker Saturday, sending his team home from the Confederations Cup on a high by scoring twice to clinch a 2-1 victory over Japan in their final Group A match.

With seven goals in his last eight games for Mexico, the 25-year-old Manchester United striker has now climbed up his country's all-time scoring leaderboard to third spot, which he shares with retired forward Luis Hernandez.

"He's always been a very insistent, determined player," said Mexico coach Jose Manuel De la Torre, who also managed Hernandez at Guadalajara.

"He's highly competitive, and has a huge dynamic and sense of timing in order to score ... and that is what has taken him to be at these very high levels with Manchester United. Now he's simply responding with these goals for the national team."

After struggling to threaten in the first half at the Mineirao Stadium, Hernandez met Andres Guardado's cross in the 54th minute and headed in again in the 66th from Giovani Dos Santos' corner.

Shinji Okazaki pulled one back for Japan in the 86th and Hernandez won a penalty in stoppage time, but his weak effort was saved and he then sent the follow-up against the crossbar.

Both Mexico and Japan were playing only for pride, having been eliminated from the Confederations Cup by losing their first two matches at the 2014 World Cup test event.

"We have an unpleasant taste in our mouths — we don't like seeing our team being eliminated early from a tournament," Hernandez said through a translator.

"But Mexico at least made it to the (Confederation Cup) finals ... and this victory helps us in building the confidence back."

Although Japan leaves Brazil having finished bottom of its group without a point, the team's return trip to Brazil is already guaranteed.

The Asian champions were the first World Cup qualifiers while Mexico is still slugging it out for a spot from the CONCACAF confederation.

Japan was the speedier and hungrier initially, picking up where it left off in Wednesday's slender 4-3 loss to Italy.

Using their pace down the flanks, the Japanese were displaying the dynamism the Mexicans were lacking at first.

Japan striker Shinji Okazaki found the net after 10 minutes from the edge of the area, but it was ruled out for a border-line offside decision.

An early effort from Shinji Kagawa was blocked by the boot of goalkeeper Guillermo Ochoa, who also easily collected a low strike from Keisuke Honda.

For all the creativity and slick passing, the Japanese had nothing to show for its domination.

Mexico eventually got a foothold in the game, with Jesus Zavala heading over from a free kick and testing goalkeeper Eiji Kawashima with a long-range effort that was turned wide.

Only the post prevented Mexico going in at half time in front, with Andres Guardado given the space to meet Jorge Torres' cross with a free header that crashed against the woodwork.

The Mexican momentum carried over into the second half, with the team looking sharper as Japan faded.

"You could say there was little petrol in our tank," Japan coach Alberto Zaccheroni said through a translator.

Hernandez soon began to find himself in goal-scoring positions, with defender Hiroki Sakai throwing himself at the ball to deny the striker's first effort of the half.

The Japanese defense was finally breached as it failed to track Hernandez in the penalty area and headed in twice, from a cross and a corner.

"He was very good at headers even though he's not that tall," Zaccheroni said.

"If you look how we conceded goals, our defense line was all there and we conceded goals because of high play ... it wasn't the case of the opposing players outnumbering ours," Zaccheroni added.

Dos Santos has been one of Mexico's most dangerous players in Brazil and, on the turn, twice unleashed powerful shots that Kawashima did well to keep out.

As Mexico pressed with confidence, Japan struggled to gain control of the ball, and the finishing was deficient when it did, with Ryoichi Maeda and Yasuyuki Konno striking wide.

The consolation came when Okazaki was left in space in front of goal to meet a cross from captain Yauhito Endo.

And Hernandez's penalty miss — after being fouled by Maya Yoshida — ensured the result was the same as when the sides met at the 2005 Confederations Cup.