Wambach, who came in as a substitute to start the second half, scored on a penalty kick in the 58th minute and added a header in the 72nd minute to bring her career total to 182 goals. She has scored 24 goals against Mexico, the most she has against any nation.
Lori Chalupny added a goal for the United States early in the second half.
Ariana Calderon scored on a header for Mexico late in the first half, which snapped Hope Solo's shutout streak at five matches. Calderon's was the first goal the U.S. had conceded to Mexico since November 2010, when Las Tri surprised the Americans with a 2-1 victory in World Cup qualifying.
The Americans were playing without forward Alex Morgan, who has a bone bruise in her left knee. Morgan also might miss the final send-off match against South Korea on May 30 at Red Bull Stadium in New Jersey.
"She's doing well. We still have not had her back in full training, but she's feeling better, and we're going to keep it precautionary and be conservative with her through the end of this camp and potentially through the next camp as well," coach Jill Ellis said.
Mexico goalkeeper Cecilia Santiago was the star early on, fending off two tremendous attempts by Megan Rapinoe in the 14th minute. Santiago played in the 2011 World Cup at age 16, which made her the youngest women's player to appear in goal in a tournament match.
Leroux scored from a seemingly impossible angle in the 28th minute for her first goal in 14 matches, which put the United States up 1-0.
Rangel got a shot off when Hope Solo was occupied in the 36th minute, but it went slightly wide of the far post. Las Tri evened it just before the half on Calderon's header.
Chalupny entered the game to start the second half and scored on her first touch, off a feed from Wambach in the 46th minute, to put the Americans up 2-1.
After Wambach took advantage of the penalty kick when Arianna Romero was called for a handball, Leroux added her second on a fast break in the 61st minute. Wambach's header closed out scoring.
Earlier this week, both teams played closed-door matches against Canada, which also was training in Southern California. Canada beat Mexico 1-0 on Thursday. A day earlier, Canada and the United States played to a 1-1 draw. Because the matches were closed, they do not count as international friendlies. It is the policy of U.S. Soccer not to comment on such matches, but Ellis said she was pleased with her team's performance.
"We got everybody in the game, so it was good to see our depth," Ellis said. "Played it on turf. I thought at times our speed of play was very, very good. We created a lot of opportunities. It was just really good for us to play such a good opponent this close to the World Cup."
The United States was officially coming off a 3-0 victory over Ireland on Sunday in the first of a three-match send-off series before the World Cup. Wambach scored twice, and defender Julie Johnston added a goal.
Mexico coach Leo Cuellar told The Associated Press he will likely wait to announce his World Cup roster until closer to the May 25 deadline due to injuries that have impacted his squad.
Mexico Forward Tanya Samarzich watched the match from the sidelines on crutches with her right foot in a boot. Samarzich, who played for USC, was apparently injured in one of Mexico's closed-door matches.
The United States opens the World Cup on June 8 with a match against Australia, while Mexico opens with Colombia on June 9 in Moncton, New Brunswick.
Attendance for Sunday's match was announced at 27,000, a sellout and the largest crowd for a U.S. women's match at StubHub Center.
Highlights: United States 5-1 Mexico
United States demolished Mexico 5-1 thanks to goals from Sydney Leroux and Abby Wambach.