Nineteen of the dead have been identified as prisoners and their supporters trying to rescue them from outside.
One prison guard also died. Four other guards were injured, one severely, said public security officials of Para state.
According to the Secretariat of Public Security and Social Defense of Para, a group of prisoners began a riot with kidnapping six security guards.
Meanwhile, their allies outside attacked one of the gates with explosives, to which the guards reacted by opening fire.