US President George W Bush has said efforts to reform US immigration laws are key to improving ties with Mexico.
President Bush says he is optimistic about reforms to immigration laws
Speaking with Mexican President Felipe Calderon, on the last leg of a tour of Latin America, Mr Bush said he believed the US Congress would approve new laws.
He was keen for legislation that would "respect the rule of law - and at the same time, respect humanity," he said.
Hundreds of protesters earlier rioted outside the US embassy in Mexico City, in the latest protest against his tour.
Demonstrators burned US flags and threw stones at police guarding the building. Several people were injured, including a number of police officers.
There have been protests at each stage of Mr Bush's trip, and verbal attacks on him by Venezuela's President Hugo Chavez, who is on his own tour of the region.
The US president has visited Brazil, Uruguay, Colombia, Guatemala and finally Mexico on his seven-day tour.
Speaking at a news conference in the eastern city of Merida, Mr Bush called immigration an "important but sensitive" issue.
He said a reform of immigration laws was essential - and added that he was optimistic that both parties in Congress were coming round to his view.
"If people can come into our country, for example on a temporary basis to work, doing jobs Americans aren't doing, they won't have to sneak across the border," said Mr Bush.
"And, by the way, a system that encourages people to sneak across the border is a system that leads to human rights abuses.
"It's a system that promotes document forgers. It's a system that allows for the exploitation of citizens who are trying to earn a living for their families."
Mr Bush added that he did not envisage widespread amnesty programmes or mass deportations of illegal immigrants.
The US is planning to construct hundreds of kilometres of fencing along the border to try to prevent the flow of illegal immigration from Mexico - a measure Mr Calderon has strongly criticised.
Mr Calderon said the challenge for Mexico was to improve the opportunities it offered, in order to encourage young Mexicans to stay in the country or to return from the US.
"We share the need of having a safe border that will close the gates to drugs, arms and terrorism and that will open its doors to trade, investment and prosperity," he said.
The BBC's Duncan Kennedy in Merida says Mr Bush's comments on immigration represent the position he has long held.
Like much of the trip there has been a shortage of new policies, our correspondent says.
Instead, the tour is being viewed as one that has cemented political relationships rather than develop new programmes, he says, making it likely that there will be a mixed reaction over whether it has been a success.