The 22 men and 9 women did not have visas to be in Mexico and said they were being held by a group of armed men who had demanded money for their release, the interior ministry said in a statement.
The Cubans were taken to local offices of the federal attorney general for medical checkups and were set to be deported, the ministry said.
Hundreds of Cubans who were in the process of trying to reach the United States were stranded in Mexico and Central America after the United States repealed in January the so-called "wet foot, dry foot" policy that granted residency to almost every Cuban who reached US soil