The bloodbath erupted on Saturday night in the overcrowded Alcacuz prison in the northeastern state of Rio Grande do Norte. Similar violence at other jails in Brazil left around 100 inmates dead in early January.
"Twenty-six deaths have been verified," the state's public safety manager, Caio Bezerra, told a news conference on Sunday. The authorities had earlier estimated around 30 were killed as they gathered bodies and body parts, he said.
Security forces stormed the prison at dawn and restored order after 14 hours of violence, the local authorities said. Officials said members of two drug gangs clashed violently after coming out of different parts of the prison. One family member said the authorities did not seem to be doing everything they could -- even after she warned the prison director.
"The (prison) director even said he could not do anything" when told an uprising was looming, said Adriana Feliz, the sister an inmate. "I told the director they were going to go in and kill everyone in Pavillion 4," she added.
"So why didn't they do anything?" President Michel Temer said on Twitter that the federal government stood ready to provide "all assistance necessary." Separately, officials in the southern state of Parana said 28 prisoners escaped from a jail in the city of Curitiba after inmates blew up a wall and fired on police.
At Alcacuz, security forces surrounded the prison but had to wait until first light on Sunday to storm the site with armoured vehicles, officials said. Prisoners had cut off the electricity and were said to have firearms.
The prison, just outside the state capital Natal, was built for a maximum of 620 inmates, but currently houses 1,083, the state justice department said. The riot was thought to have been a clash between Brazil's biggest drug gang, the First Capital Command (PCC), and a group allied to its main rival Red Command, Brazilian media said.
Experts say the violence is part of a war between drug gangs battling for control of one of the world's most important cocaine markets and trafficking routes. Violence in the first week of January left around 100 prisoners dead -- many of them active gang members, the authorities said.
Many of the victims were beheaded, disembowelled or dismembered, officials said. The biggest bloodbath, in the northwestern city of Manaus, left about 60 inmates dead. It appeared to be an orchestrated mass killing targeting members of the PCC. Dozens of inmates are still missing.