Mexicans watched in horror as their side were thumped 3-0 in Yekaterinburg, leaving them keeping a nervous eye on the match between Germany and South Korea about 500 miles (800 kilometres) to the west in Kazan.
But Mexico City exploded with joy when South Korea scored two injury-time goals to eliminate the defending world champions in a huge upset.
Hundreds of Mexican fans mobbed the South Korean embassy to chant "We are all Koreans!" as one lifted the consul general Han Byoung-jin onto his shoulders.
Videos posted on social media also showed ambassador Kim Sang-il sharing a bottle of tequila with fans and jumping up and down as the crowd partied outside the embassy, chanting "Korean brother, now you're Mexican".
The embassy was bombarded by phone calls thanking South Koreans, Yonhap news agency said, including one from Mexico's undersecretary for foreign affairs.
Mexican finance minister Jose Antonio Gonzalez Anaya also called his counterpart in Seoul to thank South Korea, Seoul's finance ministry said, promising to treat him to a meal at the next G20 finance ministers' meeting.