Cruz Azul will play Real Madrid in the Club World Cup semi-final following their 3-1 extra-time win over nine-man Western Sydney Wanderers.
In a match played in farcical conditions on a heavily waterlogged pitch at the Stade Prince Moulay Abdallah on Saturday, Iacopo La Rocca's stunning goal midway through the second half looked to have put the Wanderers on track for a clash with the European champions.
But following Matthew Spiranovic's red card soon afterwards, a clumsy Shannon Cole challenge gave Mexican outfit Cruz Azul a penalty with just two minutes remaining, which captain Gerardo Torrado converted to send the match to extra time in Rabat.
Nikolai Topor-Stanley - wrongly booked in the second half in a case of mistaken identity - was then shown a second yellow in extra time, leaving Tony Popovic's side to try and hold on for penalties with just nine men.
But the Asian Champions League winners could not do it as Mariano Pavone and another penalty from Torrado sealed the result for Cruz Azul, as they moved into the last four along with Oceania's Auckland City, who upset ES Setif earlier in the day.
After a goalless first half, the Wanderers took a 65th-minute lead via Italian midfielder La Rocca
Seyi Adeleke's cross was cleared out by the Cruz Azul defence, with the ball trickling into the path of La Rocca, who let fly with a rasping low drive from distance that fizzed off the wet surface and into the bottom corner.
But just as the Australians seemed on track for a remarkable semi-final berth, Cruz Azul equalised from the spot in the 89th minute to force extra time, after Marco Fabian was brought down.
It got worse for the Wanderers in the 108th minute, with Pavone on hand to net a simple tap in after Ante Covic had produced a superb save to deny substitute Ismael Valadez.
Cruz Azul put the result beyond doubt two minutes from the end of the extra period when Mateo Poljak was penalised inside the area for handball and Torrado made no mistake from the spot.