The centre of Rio was packed with more than 10,000 people marching peacefully.
But as it got dark, some protesters threw firebombs at public buildings and riot police responded with tear gas.
A similar protest in Sao Paulo also ended in violent confrontation with police after many banks were ransacked by hooded protesters.
Brazil’s security situation is a challenge to cities that will play host to the 2014 World Cup and 2016 Olympic Games.
The latest demonstration took place over several hours and was peaceful at first.
But once night fell, violent incidents broke out as at least 20 “black bloc” anarchists smashed a City Hall gate while others broke into banks and tried to break into ATMs. Some banks were set alight.
Demonstrators also torched a bus on busy Rio Branco Avenue, and took furniture out of banks to use in barricades as the stand-off off with police continued.
Authorities used tear gas to restore order.
“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 have been demanding a pay increase for two months. About 50,000 people were estimated to have marched to support them before the violence broke out, but police would only confirm the 10,000 estimate.
ojJUq5vXZk4Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…