It appeared as though Mexico coach Jose Manuel de la Torre was going to retain his unbeaten record before two goals in a four-minute stretch stunned El Tri.
Just when it seemed Mexico was going to walk away with another victory under new head coach Jose Manuel de la Torre, Brazil scored two unanswered goals within a span of four minutes as the game drew to an end to hand the home team a 2-1 loss at the Estadio Corona.
And the South American nation did it with only 10 players.
Ronaldinho scored on a beautiful free kick from just outside the box in the 79th minute and Marcelo muscled his way to the game-winner in the 83rd for Brazil, which played the entire second half shorthanded after Dani Alves was tossed out with a red card.
Mexico's only goal came on an own goal from David Luiz just minutes into the contest.
De la Torre lost for the first time since making his debut as manager in February. His record drops to 10-1-4 on a night when it looked like everything would go Mexico's way.
"There are no 'almosts' here," de la Torre said. "There's no excuses. There are really clear reasons as to why this happened, no more. These are games we use to prepare, we mustn't forget that, so that we can get the objective that we have planned out for ourselves: to get to the World Cup."
The scoring started with Luiz's mistake in the 10th minute. As Mexico's Pablo Barerra placed a low cross in front of the visitors' net, the defender slid and deflected the ball into his own goal.
Brazil responded by putting pressure on El Tri in what would end up being a very physical first half that featured five yellow cards, including two for Alves.
Alves picked up his first yellow in the seventh minute and the second right at the end of the first half after taking down Javier 'Chicharito' Hernandez in the box. It was a hard bump into the smaller Hernandez, who was tossed off his feet. The referee had no choice but to hand out a card and award Mexico with a penalty kick.
Stepping up for the spot kick was Andrés Guardado with an opportunity to give his team a two-goal cushion. But the winger's low attempt was blocked by goalkeeper Jefferson at the right post.
"Those are the circumstances of the game," Guardado said. "You can't miss if you don't shoot - those are things that happen. If there's another penalty kick, I have the personality to kick it again. It's not a big deal."
Even without one of its key players, Brazil still had scoring opportunities in the second half and finally capitalized just when it appeared Mexico was feeling confident of victory.
Ronaldinho used tremendous power and accuracy to beat Mexico goalkeeper Oswaldo Sanchez to his left. Moments later, Marcelo put his head down and walked the ball through defenders for an open strike to seal the win.
"We made mistakes on both goalscoring plays," de la Torre said. "You can't give them any advantage because of the quality they have."
Additional reporting contributed by Diego Hernandez