Mexico stayed alive at the CONCACAF Gold Cup with a dramatic penalty shoot-out win over Costa Rica in the quarter-finals on Saturday.
Raul Jimenez's first-half goal had put Gerardo Martino's side ahead at NRG Stadium in Houston, Texas.
However, Bryan Ruiz's controversial second-half penalty drew Costa Rica level and a shoot-out followed despite chances for both sides.
Guillermo Ochoa made a brilliant save late in extra time and again in the shoot-out, denying Keysher Fuller to claim a 5-4 success.
Despite a lively start by both teams, there were few chances at either end until Costa Rica threatened just after the half-hour mark.
Celso Borges stepped up to curl a 25-yard free-kick just wide, before the midfielder later hit the post, although the move was flagged offside anyway.
Instead, Mexico took the lead just before half-time through Jimenez.
Jimenez's initial strike after a Rodolfo Pizarro cross from the left was blocked, but he produced a composed finish from inside the area to make it 1-0.
Costa Rica found a way back into the game early in the second half after a controversial penalty decision.
Luis Rodriguez was ruled to have brought down Joel Campbell, who was about to shoot, although replays showed he got the ball and any contact appeared to occur just outside the area.
Still, Ruiz made the most of the chance from the penalty spot, converting to bring Costa Rica level.
That seemed to bring Mexico back to life as Jimenez forced a fine save from Leonel Moreira before also shooting wide in the 62nd minute.
In what was an end-to-end finish to the 90 minutes, Mexico almost found a winner through substitute Carlos Rodriguez, who hit the crossbar from close range.
The chances continued in extra time, the best falling for Jonathan McDonald, whose powerful low strike was well saved by Ochoa in the 108th minute.
Jimenez had a penalty saved to begin the shoot-out but Mexico recovered, Randall Leal missing the target before Ochoa superbly denied Fuller.
What does it mean? Mexico find a way, but only just
It looked like Martino's perfect record at the helm was coming to an end as Mexico fell behind in the shoot-out. However, after seven wins from as many games under Martino heading into their meeting with Costa Rica, Mexico found a way again.
Ochoa steps up at key moment
Mexico only got to penalties thanks to Ochoa, who did well to deny McDonald in extra time. The goalkeeper then delivered the key save in the shoot-out, diving to his right to deny Fuller.
Martino mistake for Mexico
They edged into the semi-finals, but Mexico will need to find a way without Martino in the last four. The coach picked up his second yellow card of the tournament during extra time and is suspended.
Mexico will face surprise semi-finalists Haiti on Tuesday, while Costa Rica look ahead to a friendly against Uruguay in September.