Thousands marched in Rio de Janeiro to support teachers seeking pay hikes before masked anarchists turned to violence, setting fires, breaking into buildings and smashing a City Hall gate.
The demonstration took place over several hours and was peaceful at first.
But once night fell, violent incidents broke out as at least 200 "black bloc" anarchists smashed a City Hall gate while others broke into banks and tried to break open ATMs and set some alight.
Demonstrators also torched a bus on busy Rio Branco Avenue, and pulled furniture out of banks to use in barricades as they squared off with police.
Authorities used tear gas to get the crowd under control.
Afterward, the streets looked like a battle zone, with buildings damaged, trash burning and the smell of tear gas.
A similar rally in Sao Paulo also turned violent. Seven people were injured, including four police officers, the newspaper O Estado de Sao Paulo reported.
In Rio, the trouble started when the "black bloc" demonstrators tried to break into town hall. At first only unarmed security guards were on hand but riot police eventually showed up and fired tear gas.
"Without the police, there is no violence. When they are there, there always is," said anarchist Hugo Cryois, 23, who had a gas mask dangling from his neck.
"I came prepared," he said. "You can't trust them."
Teachers who have been pressing for a pay raise for two months said 50,000 people marched to support them before the violence broke out. Police would only confirm the 10,000 figure.
Brazil's security situation is an ongoing challenge in the city that will host the 2014 World Cup and 2016 Olympic Games.