Despite losing Luis Tejeda to a red card in the first half, a header from Roman Torres handed Panama the lead, but Mexico levelled with a controversial penalty in stoppage time before Guardado sealed the win in extra time to send them through to a final with Jamaica, who recorded a surprise 2-1 victory over the USA earlier in the evening.
It was Mexico who started the better of the two sides, but dominating possession did not bring chances for Miguel Herrera's charges as they often struggled to slice open the Panama defence.
Panama were dealt a huge blow midway through the first half when Tejeda was shown a straight red card for an elbow on Maza, and the reaction of players from both sides delayed the game for a few minutes as the officials struggled to control proceedings.
Carlos Vela came agonisingly close to breaking the deadlock early in the second when his free kick beat the wall but drifted just a few inches over the crossbar.
Panama took the lead just a few moments later as sloppy defending from Mexico gifted the opener to Torres, who powered home a header from Armando Cooper's free kick.
Despite stepping up the tempo, Mexico struggled to create clear chances for long spells of the second half until Vela headed just wide of the post.
Panama continued to threaten at the other end as the lively Cooper forced Ochoa into a stunning save, before creating a chance for Roberto Nurse, who could only find the side-netting with his effort.
It looked like Panama would hold on for the win until a dramatic moment in the 89th minute as the referee pointed to the spot after deciding that Torres had handled inside the box.
Replays proved that the defender had not handled the ball after falling over, and the referee quickly lost control as players from both sides clashed with water bottles being thrown and both managers being forced onto the pitch in an attempt to defuse the situation.
The match was delayed for almost 10 minutes, but Guardado managed to keep his composure from 12 yards to force extra time with a calm penalty.
Both sides went in search of a winner in the first extra period, but with fatigue an issue for the 10 men of Panama, another decision went Mexico's way when Oribe Peralta went down in the box under pressure from Torres.
Guardado took on the responsibility once again to secure the win with another fine finish from the penalty spot as Mexico held off their rivals in the second half of extra time to set up a meeting with Jamaica.