This is the latest violence to hit the Litoral penitentiary, which just a few weeks ago was the scene from the worst prison massacre in the country.
The fighting lasted nearly eight hours in the prison in the coastal city of Guayaquil.
Authorities blamed prison gangs linked to international drug cartels for the violence.
Governor Pablo Arosemena of Guayas province, where Guayaquil is located, said the detainees “attempted to dynamite a wall to enter pavilion two to commit a massacre. They also burned mattresses in an attempt to drown (their rivals) in smoke.
“We are fighting against drug trafficking. It’s very hard. “
Police commander Tanya Varela said authorities using drones found detainees to be armed with firearms and explosives.
Authorities said in addition to the 58 dead, 12 detainees were injured and authorities seized bombs and guns.
The prison violence comes amid a nationwide state of emergency ordered by Ecuadorof President Guillermo Lasso in October which allows the security forces to fight drug trafficking and other crimes.
Ecuadorian prisons are experiencing a wave of brutal violence.
In late September, another battle between gang members in Litoral Prison killed at least 118 people in what authorities have described as the worst prison massacre the South American country has ever committed.
Authorities said at least five of the dead were beheaded.
In February, 79 inmates were killed in simultaneous riots in various prisons. So far this year, more than 300 prisoners have died in clashes in prisons across the country.