It completed an excellent comeback for the central Americans whose appearance in a first Olympic final was under threat following Yuki Otsu's first-half screamer.
But Marco Fabian's glanced header levelled affairs before Peralta's sweet strike and Javier Cortes' late finish proved enough to send the Mexican fans into a state of delirium.
Both sides had remained undefeated in their run to the semi-finals and the coaches' starting line-ups reflected those superb performances, unchanged from their quarter-finals.
Chances came at a premium early in the game with both teams limited to long range sighters. First of all Peralta dragged a shot off target for Mexico after a dangerous run from Giovani dos Santos before Hiroshi Kiyotake came even closer for Japan fizzing a drive inches wide of Jose Corona's right hand post.
Neat build-up play eventually led to the ball being played into Otsu. The midfielder took one touch to set himself before crashing an unstoppable right-footed shot into the top left hand corner from fully 25 metres with Carlos Salcido failing to close him down.
Mexico immediately went about trying to find an equaliser. Fabian tested Shuichi Gonda with a scuffed shot on 20 minutes before Dos Santos was brilliantly tackled just as he was about to pull the trigger moments later.
The Tottenham winger then had Mexico's best chance of the game but could only bend his shot wide when a cross broke to him on the edge of the penalty area.
Mexico's increasing pressure finally paid off in the 28th minute to become the first side to breach Japan's defence at the Games. A right-wing corner was flicked on at the near post and Fabian glanced his header into the far corner to haul his side onto level terms.
It was Japan's turn to be rattled as Mexico broke quickly a minute later, Dos Santos bursting down the left side of the penalty area. The 23-year-old got his angles all wrong though, chipping harmlessly over Gonda's crossbar.
The rest of the half was played out with little further incident though, with Mexico ending the first 45 minutes on top after Japan's early flurry.
The start of the second half was reminiscent of the first, with Japan quickly onto the front foot.
And the first real chance fell their way with Takahiro Ohgihara seeing his shot blocked before the rebound was driven well over the bar by Nagai when he should have hit the target.
It was the only early chance of a decidedly scrappy second half with both teams pressing and probing with little to show for it, but Mexico took the lead through another spectacular long-range strike.
Gonda had initially saved Peralta's snatched shot but following the goalkeeper's throw out, midfielder Ogihara dallied on the ball for far too long.
Peralta nicked the ball off him, before bending a wicked 25-yard shot beyond Gonda's despairing dive to put Mexico within touching distance of the final.
The Japanese attacked but Mexico comfortably held out and looked dangerous themselves on the counter attack as Japan failed to create any clear cut chances in retaliation, seemingly lacking any concerted urgency to pull themselves level.
And it was from such a counter attack that substitute Cortes was able to drive into the Japanese penalty area before dispatching a low drive past Gonda.
Seconds later, Gianluca Rocchi blew the final whistle to signal Mexico's first showing in an Olympic final where they await Brazil or South Korea.