The bodies were found near the remains of seven burned-out vehicles near the border town of Miguel Aleman.
President Andres Manuel Lopez Obrador said the killings Wednesday appear to have been part of a dispute between gangs.
He said details would be released once all the information was gathered.
A Tamaulipas state official who was not authorized to be quoted by name said investigators had counted 21 bodies at the scene.
The area around Miguel Aleman had long been dominated by the Zetas drug cartel, which was locked in a battle for control of crime in the Rio Grande Valley with the rival Gulf cartel. Miguel Aleman is about 50 miles (80 kilometers) west of McAllen, Texas, which was to be visited Thursday by U.S. President Donald Trump as part of his campaign for a wall or barrier along the border with Mexico.
The Zetas cartel has since splintered, and the deaths in Miguel Aleman appear to have resulted from a dispute between the Gulf cartel and one of the Zetas factions, the Northeast cartel.
Tamaulipas has been a major conduit for drug shipments and has also been the scene of some of the worst massacres and fiercest fighting in Mexico's drug war.
RELATED: 7 dead in shooting at Las Virginias bar in Playa del Carmen, Mexico