12 others were injured during the "pitched battle" that lasted 30 to 40 minutes at the Topo Chico prison in the northern industrial city of Monterrey, said Nuevo Leon state Governor Jaime Rodriguez.
The fight erupted following a dispute between leaders of two rival groups, including one led by a member of the Zetas drug cartel, Rodriguez said.
"They used sharp weapons, bats, sticks," the governor told radio Imagen, adding that the 60-year-old penitentiary houses 3,800 inmates, twice its capacity.
The riot erupted on the eve of Pope Francis' trip to Mexico, during which he is due to visit another notorious prison, in the northern border city of Ciudad Juarez.
Also Read
Angry relatives flocked to the prison and tried to force their way in, desperate for information about loved ones caught in one of the deadliest Mexican prison riots in recent years.
Rodriguez told a news conference that the clash erupted before midnight yesterday and that authorities brought it under control at 1.30 am today.
"We can confirm the deaths of 52 people. ... The process of identifying victims continues," he said, adding that all the victims were male inmates.
Five of the injured inmates were in serious condition.
Rodriguez rejected speculation that women or children may have been inside at the time of the riot.
Troops and federal police were deployed inside the prison to keep it under control. Rodriguez said no inmates escaped and no firearms were used.
Ambulances were sent to the prison while scores of relatives crowded at the entrance, throwing rocks and pulling the gate open as riot police blocked their way with a parked vehicle.
Some relatives of prisoners formed a line by holding hands to block a boulevard.