The attacks on police stations, patrols and barracks, took place in several cities across Sao Paulo state over a 12-hour period on Friday evening, local time.
It is thought that the incidents were related to the transfer of organised crime leaders from a criminal group known as the First Command Capital (PCC) to a higher security prison.
The attacks, which began at 2300 GMT and ended early on Saturday, left 23 police officers and two civilians dead, the State Security Office said.
At least five members of the PCC, too, died in the attacks, authorities said, while about 15 were arrested.
Local television news footage showed scenes of police cars riddled with bullets and stations with puddles of blood on the pavement outside.
"They have struck at the spinal cord... of our security"
Saulo de Abreu. secretary of security for Sao Paulo state
Police said they would not be intimidated by the violence.
"The police will not retreat from these attacks," Saulo de Abreu, the secretary of security for Sao Paulo state, told a local news station.
"They have struck at the spinal cord... of our security."
Meanwhile, uprisings were reported in several prisons in the area, which Nagashi Furukawa, the Sao Paulo State prison affairs secretary, said appeared to have been orchestrated by the PCC.
There were also reports of small numbers of hostages being taken.
Brazil's prisons are notoriously overcrowded and often rocked by violent unrest.