Police used tear gas but failed to repel thousands who broke through barriers, climbed on top of rooves, broke glass in windows and invaded all three buildings, which are connected through the vast Three Powers square in Brasilia.
The violence happened a week after left-wing veteran Luiz Inácio Lula da Silva’s inauguration.
Images on TV channel Globo News showed protesters roaming the presidential palace, many of them wearing green and yellow, the colours of the flag that have also come to symbolise the Bolsonaro government.
“This absurd attempt to impose their will by force will not prevail,” said Justice Minister Flavio Dino on his Twitter account.
“The government of the Federal District has ensured there will be reinforcements. And the forces at our disposal are at work.”
Senate President Rodrigo Pacheco said he was in permanent contact with Brasilia’s governor, Ibaneis Rocha, and that the entire police apparatus had been mobilised to control the situation.
Supporters of Bolsonaro refuse to accept that he lost the election.
They have been protesting against Lula’s electoral win since October 30, blocking roads, setting vehicles on fires and gathering outside military buildings, asking armed forces to intervene.
It is unclear if they are still in Congress.
Footage uploaded to social media also showed rioters storming the nearby presidential palace and the Supreme Court.
Bolsonaro’s supporters are calling for military intervention and the resignation of Mr da Silva – better known as Lula.
Many are drawing comparisons with the storming of the US Capitol by supporters of Donald Trump on January 6, 2021. Trump is an ally of Bolsonaro.
Bolsonaro flew to the US to avoid the handover ceremony and has not yet condemned or commented on the ongoing situation.
Lula is currently on an official trip in São Paulo state.
In his inauguration speech, he vowed to rebuild a country in “terrible ruins” and decried the policies of his predecessor.