About 300 troops have been sent to the northern city of Fortaleza to tackle a surge in criminal violence, authorities said.
Soldiers will patrol there and across the state of Ceará in a bid to halt attacks on shops, banks and buses.
The justice ministry ordered the special deployment after dozens of attacks this week.
The attacks are a protest against new, tougher measures in local prisons, largely controlled by criminal gangs.
Prison authorities in the state have blocked mobile phone signals inside jails and ended a policy of separating inmates by gang affiliation.
The troop deployment comes just days after the inauguration of President Jair Bolsonaro, who was elected to office on the promise to fight rampant crime in the country.
Mr Bolsonaro reportedly praised Justice Minister Sergio Moro’s decision to send in troops as “apt, rapid and effective”.
Security videos aired on Brazilian television show the gangs setting fire to service stations.
About 50 suspects allegedly linked with the violence have now been arrested.
According to World Prison Brief, Brazil has more than 700,000 people behind bars – the third-highest prison population worldwide after the US and China.