At least 28 inmates have been killed in a brutal prison fight in the Mexican Pacific resort of Acapulco, in one of the worst outbreaks of violence in the country's troubled penal system in recent years.

Rioting inmates beheaded and mutilated their rivals on Thursday and bodies were found strewn around the maximum-security wing, the kitchen, a prison yard and a conjugal visiting area after the pre-dawn riot at the CERESO federal prison in Acapulco, said the security spokesman for the state of Guerrero, Roberto Alvarez.

"The incident was triggered by a permanent feud between rival groups within the prison," he told a news conference.

State police regained control of the prison, backed by federal police and the army, which set up a security cordon outside, he said before adding that the governor ordered an investigation, including of prison staff.

Guards said some of the victims had their throats slit, according to an internal state police report.

Mexico's chronically overcrowded prisons are frequently hit by riots and jailbreaks.

Acapulco, a resort town on Mexico's Pacific coast, has been hit by grisly violence between warring drug cartels in recent years. It is the biggest city in Guerrero, one of Mexico's most lawless states and a centre of opium poppy production.

The killings in Acapulco are the latest example of an upsurge in violent crime that has turned 2017 into one of the bloodiest years in the country's modern history.

Acapulco was once a playground for Hollywood stars. However, in recent years it has been roiled by vicious gang warfare, and is now ranked one of the most murderous cities in the world.

Early last year, 49 people died in a battle between members of the feared Zetas drug cartel and rivals at a prison in the northern industrial city of Monterrey.