The violence began with two grenade explosions at a makeshift prison for gang members and apparently coordinated attacks by Mara Salvatrucha gang members against the rival MS-18 gang at other prisons, Interior Minister Carlos Vielmann and Escuintla Gov. Luis Munoz said.
Rival gang members fought bloody clashes with guns and knives before the violence was brought under control.
Eighteen people died within about 45 minutes at El Hoyon, a police barracks-turned-prison for about 400 alleged gang members in downtown Escuintla, a provincial capital some 30 miles south of Guatemala City.
An Associated Press photographer saw bodies riddled with bullet wounds and tattooed gang members bleeding from knife wounds being carried from El Hoyon. A guard and 61 inmates were injured.
Three others were reported killed at the Canada Prison Farm 12 miles farther south and Vielmann said eight died in rioting at Guatemala's top-security Pavon prison, about 15 miles east of the capital. Two more were stabbed to death at a prison in Mazatenango, 85 miles southwest of the capital, according to officials.
Vielmann said smaller disturbances were quashed at three other prisons.
At El Hoyon, the sound of explosions at about 9 am caused nearby shopkeepers to slam down metal shutters and brought hysteria to the mothers of inmates who had gathered for the prison's visitors day.
Police kept reporters, rescue workers and human rights monitors away from the prison until the gunfire faded. Then they began bringing out the wounded --
El Hoyon holds 400 alleged gang members. It was opened at an old police barracks after a December 2002 gang riot at another prison in which 14 inmates died.
Vielmann said Monday's attacks showed the coordinating power of the gangs who have spread terror throughout much of the region, prompting harsh official crackdowns.
"The gangs maintain constant communication," he said. "They have a Web page and not only synchronize in Guatemala, they synchronize with El Salvador, Honduras and with the United States."
He said cellular phones and messages passed by prison visitors helped maintain contact among the gang members. Vilemann also blamed visitors for slipping guns to inmates -- something he said would be a problem until new, higher-security prisons are built.
Human Rights Prosecutor Sergio Morales told reporters there was evidence that some police, too, had brought guns to inmates at El Hoyon. Law enforcement officials say the gangs emerged in Los Angeles and later spread to Central America when criminal migrants were deported back home.
A region-wide campaign against the gangs has put thousands of the tattooed "maras" behind bars, leading to prison feuds between rival gangs.
A May 2004 fire killed 107 inmates, most of them Mara Salvatrucha members, in Honduras.
That came 13 months after suspected gang members were locked in their cells, doused with gasoline and set ablaze at the El Porvenir prison farm near the Honduran city of La Ceiba. Nearly 70 people, including prisoners, visitors and guards, were killed.
Rioting has also rocked several prisons in El Salvador over the past two years.