The protests against corruption were much smaller than the massive demonstrations that shook Brazil in June, when hundreds of thousands took to the streets in a sudden outburst of anger against the country's political class for mismanaging government money and failing to provide adequate public services.
In downtown Rio de Janeiro, some 500 protesters invaded stands in the parade area, sending frightened families with children rushing for safety. Police used teargas and stun guns to disperse the demonstrators, who did not interrupt the parade.
"It was frightening. There was a wave of masked demonstrators dressed in black," said Rosangela Silva, who took a niece to watch the parade.
In Brasilia, police used pepper spray to hold back a peaceful crowd of more than 1,000 demonstrators who marched to Brazil's Congress to demand the ouster of corrupt politicians.
Protesters were only allowed to march along the wide esplanade of Brazil's capital after the annual Independence Day military parade led by President Dilma Rousseff had ended.
Organizers said many people who had intended to join the demonstrations did not turn up due to the heavy police presence and the prospect of violence seen in recent clashes in Sao Paulo and Rio de Janeiro where hooded youths have become protagonists.
Police arrested groups of youths found with hoods, gas masks, stones and slingshots in their backpacks in Curitiba and Fortaleza, cities where parades went ahead without disruption.
A demonstration in downtown Sao Paulo briefly shut down one of the city's main thoroughfares. While the protests started peacefully, some protesters spray-painted walls and threw objects at police, who responded with teargas.
Demonstrators in Brasilia later moved toward the city's brand-new $600 million soccer stadium where the Brazilian national team played against Australia in a practice game for next year's World Cup, which Brazil will host.
Riot police used police dogs and fired barrages of teargas to stop the demonstrators from reaching the stadium, which was half empty. Authorities said at least 26 demonstrators were arrested. At least two photojournalists were injured.
More than 1 million people took to the streets of Brazil's cities in June, initially sparked by outrage at an increase in bus and subway fares. The protests quickly transformed into a nationwide movement against bad public services, the rising cost of living, corruption and a host of other complaints, including anger over the $14 billion Brazil will spend on the World Cup.
While the protest targeted politicians of all parties, Rousseff's popularity plummeted shortly thereafter, clouding her chances for next year's election in which she is widely expected to run.
In response, Rousseff pledged to improve urban transport, health and education in Brazil while proposing reforms to make Brazil's political system more accountable. Her popularity has begun to recover in recent opinion polls.
(Additional reporting by Pedro Fonseca in Rio de Janeiro and Asher Levine in Sao Paulo; Editing by Eric Beech and Eric Walsh)