Brenda Walker points, below, to a Rasmussen Poll that says that "just 30% of Americans view Mexico as an ally of the United States." [54% Think Mexico Should Compensate U.S. for Costs of Illegal Immigration, Rasmussen Reports, May 6, 2013]
Until fairly recently, Mexico was a military ally of the United States. This allowed Mexico's national defense to piggyback on the US Navy and Air Force, saving them much money during the Cold War and Second World War. This was an alliance under the Rio Treaty, which is a treaty of mutual defense: its formal name is the Inter-American Treaty Of Reciprocal Assistance.
Mutual means that not only does the US protect Mexico, but Mexico is supposed to protect the US—which would have meant sending troops to Afghanistan, the way NATO ally Great Britain, and NORAD and NATO ally Canada did. See Glynn Custred asks "Where's Vicente?" VDARE.com Answers, September 30, 2001. (The Rio Treaty would not have obliged Mexico to send troops to Iraq—Canada didn't.)
On September 29, 2001, Vicente Fox, President of Mexico pledged to help fight terrorism but specifically ruled out military support.
While Fox said Mexico will help the United States diplomatically and would be willing to share intelligence and supply oil, he said he does not expect Mexico to participate in any U.S. military operation.
"Militarily speaking, we don't count. I mean, we are not a military country," Fox said. "We don't have a strong army. That is not the way we contribute."
[Mexico pledges to help U.S. fight terror, CNN, September 29, 2001]
Mexico actually has 192, 000 men under arms. This larger than the armies of Britain and Canada combined. It's large enough to be a dangerous nuisance to Americans living on the Mexican Border. But never mind—less than a year after 9/11, Mexico withdrew from the Rio Treaty. See Mexico and the Rio Treaty-Why Withdraw Now? By Allan Wall, October 4, 2002.
So the thirty percent of Americans who view Mexico as an ally are wrong.