Mexico spotted the United States a 2-0 lead when Michael Bradley and Landon Donovan both found the net in the opening 22 minutes.
But they came storming back to score the next four goals, completely changing the momentum in the Gold Cup championship final at the Rose Bowl in Pasadena, Calif.
Barrera's first goal cut the deficit to 2-1, and Andres Guardado got the equalizer before the first half was over.
Barrera scored again in the 49th minute to put Mexico in front, and Giovani Dos Santos capped off the win with a brilliant chip in the 76th.
The victory gave Mexico a spot in the 2013 Confederations Cup in Brazil.
The Americans lost their second straight Gold Cup final to Mexico after having also succumbed 5-0 in 2009.
Kate Middleton recycles dress at movie premiere
Couple mistakenly served bag of cash at McDonald's drive-thru