Hernandez still had time to miss a penalty kick in stoppage time, but Mexico held firm to claim a 2-1 win.
Look back at an entertaining clash between World Cup regulars with Sports Mole's minute-by-minute commentary below.
7.33pmEvening international football fans. Thanks for joining Sports Mole as a thoroughly entertaining group stage at the Confederations Cup draws to close tonight, with Japan taking on Mexico in Belo Horizonte.
7.36pmAnyone lucky enough to catch Japan's pulsating encounter with Italy earlier this week will be quick to tell you just how special that match was. Alberto Zaccheroni's side played bright, inventive football full of energy but somehow ended up on the losing end of a seven-goal thriller, ensuring their elimination from the competition in the process.
7.39pmMexico have also been spirited in Brazil against tough opposition and despite positive spells were unable to take any points from their first two matches, defeats to Italy and the host nation. Coach Jose Manuel de la Torre is under pressure to show signs of progression tonight, ahead of a return to a tough World Cup qualifying campaign later this year.
7.42pmThe challenge facing Japan tonight is to prove that they can match a free-flowing attacking style with some semblance of stability in defence. Zaccheroni will be without suspended captain Makoto Hasebe this evening, but star duo Shinji Kagwa and Keisuke Honda should both start in advanced attacking positions.
7.45pmBREAKING TEAM NEWS! With hopes of a semi-final place over both sides have opted to hand fringe players a chance tonight, with seven changes spread between the two teams. A full examination of both starting XI's will follow in just a few moments.
7.47pmJAPAN: Kawashima, Hiroki Sakai, Kurihara, Konno, Nagatomo, Hosogai, Endo, Okazaki, Honda, Kagawa, Maeda
7.49pmMEXICO: Ochoa, Mier, Moreno, Reyes, Torres, Torrado, Zavala, Jimenez, Giovani, Guardado, Hernandez
7.51pmDespite making four changes Mexico stick with the experienced attacking trio of Javier Hernandez, Giovanni Dos Santos and Andres Guardado. Raul Jimenez and Diego Reyes both come in for their first starts of the tournament, while Ajaccio stopper Guillermo Ochoa gets the nod in goal.
7.54pmJapan also make three changes following that end-to-end clash with Italy on Wednesday. Southampton defender Maya Yoshida pays the price for an error-strewn match against the Azzurri and is replaced by Yuzo Kurihara. Hajime Hosogai also starts in central midfield, with Kagawa, Honda and Ryoichi Maeda keeping their places going forward.
7.56pmJust a quick reminder that there is one other decisive clash in Group A tonight, with Brazil and Italy squaring off in what promises to be quite a showdown. A win for either side would see them finish top the group, avoiding what looks to be a daunting potential semi-final clash with Spain in the process. We will keep you updated on events in Salvador throughout the evening, with my colleague Matt Cotton providing live updates which you can follow by clicking here.
7.59pmPREDICTION! With the Japanese national anthem in full flow there is just time for me to hazard a guess at tonight's scoreline. I definitely expect both sides to score goals and play without pressure, but without sitting on the fence I genuinely think this match will end in a draw. I'll go for 2-2, with Manchester United teammates Kagawa and Hernandez to both register.
8.00pmPre-match formalities are complete, with Mexico to get this match underway in a changed white and red strip. I've high hopes for this clash, here we go in Belo Horizonte!
3 minMexico made an assured start in possession, with Hernandez fouled just past the halfway line by Hosogai in the first exchange. De la Torres has chosen to experiment with his formation tonight, with Jimenez playing next to Hernandez in a two-man attack.
6 minCHANCE! Japan settle with their first promising spell on the ball, featuring Okazaki and Hosogai. The little midfielder produces a wonderful piece of skill to nutmeg Guardado and pass to Endo, launching a quick counter that finds Kagawa racing into the penalty area. His quick shot is hit low and hard but just about kicked to safety by Ochoa, with Mexico scrambling to clear the rebound.
9 minA probing Japan attack is ended abruptly after Maeda bundles over Torrado just outside the penalty area. Honda is quick to recycle possession and charge forward, with his short pass failing to find a forward run into the box by Kagawa.
12 minJapan have what they think is the opening goal quickly ruled out for offside, with Okazaki's flick towards goal chalked off due to offside. The forward has little complaint and looked to have strayed beyond the last defender in his attempt to turn a wayward shot from distance towards goal. Mexico are really struggling to sustain any meaningful possession in the early stages of this match.
15 minA cross from Jimenez floats harmlessly wide and allows Japan to clear through Kagawa, with Guardado's powerful volley flying over on the rebound. Mexico are the only side yet to score from open play in this tournament, and that includes those lovable losers from Tahiti.
18 minHonda and Hernandez both have appeals for free kicks turned down within a minute at opposite ends of the pitch, a sure sign that the referee wants this match to flow early on. Japan take advantage to break forward through Okazaki, but despite beating Moreno with a clever turn inside is unable to aim a shot towards goal.
21 minMeada is caught in possession by Torrado, allowing Mexico to attack in numbers. Unfortunately for El Tri they are unable to capitalise, with Dos Santos losing possession to Nagatomo as he raced down the touchline.
24 minA quiet spell in the match sees Hernandez fouled twice inside a minute, perhaps a sign that Japan are desperate to shut down the Manchester United marksman before he can do damage in the final third. Mexico are just starting to look comfortable in possession, with Guardado looking to drift inside and create space for an overlap on the left wing.
27 minHonda manages to test Ochoa with a low strike just outside the penalty area, after the midfielder created space with a fine passing exchange featuring Kagawa and Endo. Japan are wonderful to watch when given space, but perhaps just lack the cutting edge of a truly elite international side in the final third.
29 minSakai is rather fortunate to escape without a caution after showing studs in a late tackle on Hernandez, with the referee deciding to stop short of awarding a yellow card at this stage. Endo is then penalised for handball, giving Guardado the chance to aim a cross into the penalty area with a free kick.
31 minZavala beats Sakai to meet a deep cross at the far post, but is unable to steer his header towards goal under pressure. If you were unaware that this match is a dead rubber in terms of semi-final qualification the dreaded Mexican wave from the crowd has just confirmed it after half an hour.
34 minMier makes an absolute mess of his cross out wide, despite having time and space to pick out Hernandez or Jimenez in advanced positions. A growing trend of niggling fouls then continues as Honda is tripped over by Torrado.
36 minGuardado's cross towards the far post is just too high for Hernandez at full stretch. Mexico do look a little disjointed in the final third, perhaps a sign that Chicarito and Jimenez are not partnered together too often in attack.
38 minMexico captain Torrado appears to be struggling with a head injury, after taking a stray elbow in an aerial tussle with Maeda. The 144 cap veteran decides to continue, with Hernandez just denied by a last-ditch block from Kurihara when play resumes.
41 minYELLOW CARD! A terrific run and cross down the left from Nagatomo catches Mexico off guard, but with time to strike at goal Honda takes his eye off the ball and fails to make contact. El Tri then break at the other end through Guardado, who is cynically brought down by Sakai. The full-back knew what he was doing there and picks up the game's first booking as a result.
43 minOFF THE POST! Mexico have just gone agonisingly close to an opening goal as Guardado's diving header comes back off the post. The midfielder had an age to pick his spot after finding space in the penalty area, but despite a firm contact beating Kawashima his header bounced back into play off the woodwork. Desperately unlucky there for De La Torre's side.
45 min+1Moreno is forced to flick Endo's cross away from Okazaki at the far post as Japan try to break the deadlock before the interval. Honda's following corner fails to trouble Mexico, with Dos Santos winning a corner kick of his own at the other end less than a minute later. That end-to-end passage of play just about sums up how open this first period has been in Belo Horizonte.
8.46pmHALF-TIME Japan 0-0 Mexico
8.49pmWith the final action of the first half Kawashima turned a hopeful drive from Zavala behind, but the referee decided there was no time for a corner kick to be taken. Both sides came close to an opening goal in that first period, but Group A's basement boys remain deadlocked.
8.52pmSCORE UPDATE! We have news of a goal in Group A's other match this evening, with Brazil taking the lead against Italy in first-half stoppage time thanks to a header from Dante. If that result stays the same the hosts will top Group A, meaning almost certainly that Italy will face Spain the last last four.
8.55pmBack in Belo Horizonte Japan and Mexico are both still searching for the first goal, but both sides have contributed to a match full of attacking intent. Kagawa, Honda and Guardado have shown flashes of quality in the final third, but we remain scoreless at the break.
8.58pmA change in shape for Mexico has so far failed to produce their first goal in tournament from open play, with Jimenez largely anonymous alongside Hernandez in attack. Guardado went within inches of ending that unwanted record for De La Torre's side, but his header hit the woodwork and bounced out before the interval.
9.01pmJapan have continued to play with the style that won them new fans against Italy. Kagawa looks a player reborn in a free midfield role, while Honda and Hosogai provide balance and have been impressive in spells this evening.
48 minThe floodlights have been turned on as we start the second half, with Kagawa just apologising to Okazaki for a pass hit with too much power as play resumes. A slicked clearance from Konno then gives Mexico a throw next to the corner flag as an open feel to the match continues.
51 minHernandez has shot blocked by a sliding challenge from Kurihara and quickly appeals for a penalty, believing that the ball struck the defender's hand. The referee waves away his protests but Mexico are quickly back on the attack, with Dos Santos this time having his fierce strike turned behind by a headed clearance.
54 minGOAL! Japan 0-1 Mexico (Hernandez)
57 minMexico have been rewarded for a fine start to the second half as Hernandez breaks the deadlock. The forward applied the finish with a simple header from close range and quickly rushes to acknowledge a wonderful assist from Guardado. His superb curling cross found the striker completely unmarked in the penalty area, and Chicarito did the rest for his second goal of the tournament.
59 minSUBSTITUTION: Zaccheroni has responded swiftly to conceding as Japan make their first change. Sakai has been withdrawn in place of Schalke full-back Uchida, who will come on at full-back.
62 minSCORE UPDATE! There is news of a pair of goals in the glamour Group A clash between Brazil and Italy in Salvador. Giaccherini equalised for Italy just after the break, but just five minutes later a special strike from Neymar restores a crucial lead for the hosts.
65 minSUBSTITUTION: Honda just puts too much on a diagonal pass towards Nagatomo, with Japan opting to make another defensive change with play halted. Southampton defender Yoshida is on for Maeda, with Kagawa pushed forwards to partner Okazaki in what looks a like a two-man attack for the side trailing.
67 minGOAL! Japan 0-2 Mexico (Hernandez)
70 minThe master poacher Hernandez has his and Mexico's second goal of the night, that may prove enough to secure their first and only victory of the tournament and third place in Group A. The forward wriggled free of Uchida to meet Mier's flick-on from a corner kick, heading home from close range at the far post. After throwing caution to the wind Japan have once again been undone by naive defending, which continues to undermine their efforts in this tournament.
73 minSUBSTITUTION: With a lead to protect Mexico have made a conservative change on the left side of midfield, with Salcido replacing Guardado. The former Fulham man will earn his 116th international cap tonight, with a remit of keeping possession and stopping Honda moving into space out wide.
76 minSCORE UPDATE! There has been a fourth goal in the match between Brazil and Italy, with Fred's clinical finish giving the host nation a 3-1 lead. That strike should be enough to earn the Selecao top spot in Group A, leaving Italy almost certain to face Spain in the semi-finals.
78 minBack in Belo Horizonte Japan full-back Nagatomo has gone down with that looks likes a muscle injury after blocking a shot from Dos Santos, and looks in some discomfort. The Inter Milan full-back has a poor recent injury record and is unlikely to be risked in the closing stages.
80 minSUBSTITUTIONS: Nagatomo is indeed forced to withdraw for treatment, with Nakamura swiftly introduced in his place. Mexico have also used the break in plan to make a change, swapping Dos Santos for Barrera in the closing stages.
82 minKonno gets forward and twice has the chance to cross from inside the penalty box, with his second effort blocked behind for a corner kick by Ochoa. The referee is then forced to stop play once more as Moreno feels the full force of blocking a shot with his head from only a few yards away. That one looked very painful, with the midfielder fully deserving of the time to recover.
84 minSCORE UPDATE! News of a goal that gives Italy a lifeline in Salvador as Giorgio Chiellini makes the score 3-2, with Brazil now holding a narrow lead in the final few minutes.
86 minOkazaki should have just got Japan back in this match, but at full stretch can only turn a flick volley wide from close range. Mexico then break down the right through Barrera, but Hernandez just runs out of space to meet a powerful cross at the far post for his hat-trick.
87 minGOAL! Japan 1-2 Mexico (Okazaki)
88 minJust shy of stoppage time Japan finally have the lifeline that their positive approach merited, but will it prove too little too late? Kagawa's chipped ball to the far post picked out Endo, with the midfielder sliding a teasing pass across the face of goal with his first touch. Okazaki reacted quickest to slam home from six yards, game on with just a few minute remaining!
90 minSUBSTITUTION: Mexico decide to bring on an extra midfielder as we head into added time, with Aquino coming on for Jimenez.
90 min+1PENALTY TO MEXICO! A silly challenge from Uchida on Hernandez from behind gives the referee little option but to award Mexico a late spot kick. Hernandez will surely take and has a chance to secure the victory and a hat-trick, if he can beat Kawashima from eight yards.
90 min+3SAVE! A quite incredible passage of play sees a low penalty from Hernandez saved by a strong save down low from Kawashima. The striker is quick to meet a rebound pushed back into play, but with an empty net at his mercy the striker loses his cool and lashes against the crossbar. With time fading fast can Japan race up the other end to steal a last-gasp equaliser.
90 min+5Uchida fails to keep a strong pass from Endo in play near the touchline, and with that Japan may have wasted their final opportunity to level. The referee then awards two yellow cards in the space of a minute, with Ochoa and Kurihara booked for time wasting and holding respectively.
9.52pmFULL-TIME Japan 1-2 Mexico
9.55pmIn the end Hernandez's late penalty miss mattered little as Mexico manage to end a difficult tournament on a high note, securing a 2-1 victory. The Manchester United striker still made all the difference, scoring twice after half-time to help ease the pressure on coach De la Torre.
9.58pmThat win means Mexico third in Group A, ahead of a Japan side who end the competition without a point. There is just time to report that Brazil managed to secure top spot with a 4-2 win over Italy, which means the Azzurri will face Spain in the semi-finals.
10.02pmOur coverage from tonight's Confederations Cup is just about at an end. Thanks for joining Sports Mole's coverage of a tournament that continues to surpass expectations, and be sure to return tomorrow night when Spain, Nigeria, Uruguay and Tahiti wrap up Group B. Goodnight!