Authorities found the group of migrants, which included 11 children, afer they were abducted in the northern city of Matehuala.
Mexico's military on Thursday said that troops had managed to find all 49 missing migrants who were abducted from a bus earlier this week.
Defense Secretary Luis Cresencio Sandoval said 650 police and soldiers were mobilized to search for the abducted group which included 11 children.
Sandoval said the migrants were found in a number of groups in the central state of San Luis Potosi and neighboring Nuevo Leon in the north.
Mexican President Andres Manuel Lopez Obrador said on Wednesday that a gang was responsible for kidnapping the group.
Earlier on Thursday media reported that nine people had been rescued after they fled, and at that time 40 were still missing.
Officials said the migrants were traveling north towards the US in a bus from the southern state of Chiapas when they were attacked.
Those who were rescued were from Venezuela and Honduras, according to reports citing authorities in the northeastern state of Nuevo Leon.
Some of the migrants told authorities that members of a criminal syndicate had boarded the bus when it stopped at a gas station.
The gang demanded a ransom of $1,500 (€1,383) for each kidnapped person, said the National Confederation of Mexican Transporters.
"Unfortunately, there are gangs that engage in kidnapping," Lopez Obrador said.
Gangs and drug cartels have long been active in the area where authorities had been searching for the migrants.
In recent months, a string of such kidnappings has been reported, as gangs seem to increasingly charge migrants for fees to cross Mexico and then abduct them for ransom.
The National Institute of Migration has said that more than 2,100 migrants were kidnapped in Mexico last year.
Around 35 people, including tourists and migrants, were abducted last month in the country's northeast. They were later found in a desert area.