Barack Obama said Felipe Calderon was a "true partner"
Mexican President Felipe Calderon has used the start of a state visit to the US to renew his attack on Arizona's controversial new immigration law.
Mr Calderon said migrant workers were forced to "still live in the shadows and, occasionally, as in Arizona, they even face discrimination".
President Barack Obama emphasised a message of solidarity, saying the US and Mexico would "stand together".
The battle against drugs is also high on the agenda of the state visit.
The Arizona law requires police officers to question people they stop for a "legitimate reason" about their immigration status if the officers have "reasonable suspicion" the person is in the US illegally. It takes effect on 29 July.
Opponents of the law say it will encourage racial profiling of Hispanics, who make up three-quarters of the estimated 12 million illegal immigrants in the US.
Mr Calderon has already criticised the measure as "backward" and issued a travel warning for the US state. He is under pressure from some Mexican lawmakers to cut off commercial ties with Arizona.
Mr Obama has also already been critical of the law, although it had not been expected that he would raise it in discussions with Mr Calderon.
Mr Obama said in a news conference that he had discussed the "misdirected" law with Mr Calderon, and that his administration was "taking a very close look at it", including the civil rights implications.
"No law-abiding person... should ever be subject to suspicion simply because of what they look like," Mr Obama said.
He added: "The Arizona law has the potential of being applied in a discriminatory fashion."
But he emphasised that he was "sympathetic" to Americans' dissatisfaction with the immigration system.
"The Arizona law expresses some of the frustrations the American people have had in not fixing a broken immigration system."
Both men indicated that border infrastructure would be improved.
Earlier in the day, against a backdrop of US and Mexican flags at the White House, Mr Calderon spoke mostly in Spanish, but finished his speech in English to address the question of whether the two nations could work together by echoing Mr Obama's famous campaign slogan: "Yes we can."
Mr Calderon has praised the US administration for its recognition that many of the guns used in crimes in Mexico come from the US.
Mr Obama acknowledged to reporters that US "demand for drugs helps to drive this public safety crisis in Mexico".
He also said the flow of guns from the US to Mexico must be stopped.
After the talks, the Associated Press news agency drew attention to the sometimes halting translation of Mr Calderon's comments, suggesting a translator from the Mexican delegation was to blame, and noting the official White House transcript did not use this translation.
On Thursday, Mr Calderon will address a joint session of Congress.