The agreement, signed at a ceremony in Mexico City, restricts the main exit route for thousands of Cubans as many travel via Mexico.
Mexico's past reluctance to halt the practice has led to tensions with Cuba.
More than 11,000 Cubans slipped into the US via Mexico last year, according to US authorities.
Correspondents say most evade immigration officials, and that the few who are caught are rarely deported. In most cases, they are given transit permits allowing them to reach the US border, they say.
So let me get this straight. The Mexican government encourages their citizens to flee to the United States, but they’re going to somehow stop the Cubans from crossing the border?
So the solution to our illegal immigration problem is bribe Cuba into making every Mexican a Cuban citizen.