Altamira is in Tamaulipas state, where the Zetas and Gulf cartels have been fighting a bloody war for control of smuggling routes into the US.
Gang rivalries frequently spread into Mexico's prison system.
Inmates used homemade weapons and knives in what the authorities described as a mass brawl inside the prison.
Order was only restored once troops entered the jail to help prison officers.
Many of Mexico's prisons are overcrowded and plagued by violence linked to drugs cartels.
Last October, 20 inmates died during clashes at a jail in Matamoros, also in Tamaulipas.
Violence surged in the state after the Zetas broke away from the Gulf Cartel.
More than 40,000 Mexicans have died in drug-related violence since December 2006, when President Felipe Calderon began deploying troops to combat the cartels.