Luis Tejada turned out to be the hero as he scored the equaliser in normal time and then struck the winning spot-kick
Panama have secured a berth in the semi-finals of the Concacaf Gold Cup after a 5-3 victory on penalties over El Salvador.
Rodolfo Zelaya gave El Salvador the lead from the spot after 78 minutes but Luis Tejada equalised with just a minute of normal time left.
The game went into a penalty shootout with the sides locked at 1-1 after extra-time, and Tejada struck the winning spot-kick.
Prior to kick-off both teams knew that a victory would place them in the semi-finals against the United States, who had defeated Jamaica 2-0 earlier on Sunday.
With chances going askew at both ends in the opening minutes of the match, it was El Salvador who looked set to take the lead when referee Walter Quesada awarded a controversial penalty after Rudis Corrales was brought down clumsily by Panama’s Luis Henriquez in the 21st minute.
Zelaya stepped up to take the spot-kick but could not find the back of the net with his low-hit strike being saved by goalkeeper Jaime Penedo.
Despite many chances at both ends of the pitch the first-half ended goalless.
The second-half of the contest began much like the first but this time when Zelaya was brought down in the box and awarded a penalty, he made no mistake, giving his side a 1-0 lead on 78 minutes.
Just when El Salvador looked to have wrapped up the match a late bundle by Tejada saw the ball edge over the line and Panama drew level.
The Salvadorians met the equaliser with furious protests and in the ensuing mayhem Panama’s Blas Antonio Perez and El Salvador’s Luis Anaya were sent off.
Neither of the sides were able to break the deadlock in the allotted 30 minutes of extra-time and the game went to penalties.
Dennis Alas missed El Salvador’s first penalty and that proved to be the difference with Tejada netting the winning kick to snatch a victory for Panama.