Born in Tlalnepantla, Mexico, Barrera began his career as a midfielder for Mexico City-based club Universidad Nacional, also known as Pumas. He joined Pumas youth system at the age of 11 and worked his way through the ranks to make his debut in the Primera División in 2005. He was involved in all the plays in Pumas' 8–0 victory over Veracruz.
In July 2008, Barrera had surgery to repair a ruptured cruciate ligament in his left knee that would sideline him for six months.
In early January, Barrera came back from his injury and in his very first game back he scored a goal against Necaxa. He was a starter until manager Ricardo Ferreti put him on the bench. He scored another goal that same season against Puebla. He would help Pumas reach the final in which they faced Pachuca and scored the winning goal that gave Pumas the win in the second half of overtime. Barrera enjoyed his finest season in the Torneo Bicentenario 2010 scoring six goals in 13 games, though his season was cut short as he was called up to the Mexico national football team pre-World Cup training camp.
On 16 July 2010 Barrera signed for West Ham United on a four-year contract, with a one-year option, for fee of £4m. He became West Ham's second summer signing of 2010. He made his Premier League debut, on 14 August, in a 3–0 loss to Aston Villa, coming on as a second-half substitute for Luis Boa Morte.
After making only six Premier League starts, scoring no goals and having zero assists, and not being able to help keep West Ham out of relegation, Barrera's first season in England was considered a "flop". It was reported during the summer 2011 transfer window that La Liga club Real Zaragoza wanted to sign Barrera, which would have re-united him with ex-Mexico national team coach Javier Aguirre.
On 25 August 2011, Barrera joined Spanish club Real Zaragoza on a season-long loan, which would reunite him with former Mexico national team manager Javier Aguirre and teammate Efraín Juárez. He scored his first La Liga goal for Zaragoza in a 2–2 draw against Villareal. After the sacking of Aguirre, and the appointment of Manolo Jiménez as new manager, Barrera was slowly relegated to the bench.
On 3 July 2012, Cruz Azul announced the signing of Barrera who returned to Mexico after a two-year stint in Europe.
Barrera participated at the 2007 FIFA U-20 World Cup in Canada, where he scored two goals.
Barrera has appeared for the Mexico national football team, making his debut in a friendly against Guatemala on 17 October 2007.
He scored his first international goal against Nicaragua on 5 July 2009 at the 2009 CONCACAF Gold Cup. He scored his second goal with "El Tri" in a game against Haiti national football team at the Gold Cup.
Barrera appeared in three matches at the 2010 FIFA World Cup for Mexico. Barrera made his debut in the second match against France, coming on in the 31st minute for an injured Carlos Vela. Barrera caused the second goal for Mexico when French defender Éric Abidal knocked him down in the penalty area and was given a penalty which Cuauhtémoc Blanco scored and Mexico ended up winning the match 2–0.
He was called up to participate in the 2011 CONCACAF Gold Cup. He scored the fourth goal in the 4–1 win against Costa Rica. On 25 June Barerra scored a brace against the United States in the final where Mexico won 4–2.
As of 17 August 2012As of 15 August 2012
Scores and results list Mexico's goal tally first.
Primera División (1): Clausura 2009
Copa MX (1): Clausura 2013
CONCACAF Champions League (1): 2013–14
CONCACAF Gold Cup (2): 2009, 2011