It's unclear how much time Bolsonaro would serve for his conviction for leading a coup attempt, but analysts say the move could shave 20 years off his sentence.
Bolsonaro, who began his term in November, is currently under house arrest.
In a blow to President Luiz Inácio Lula da Silva, the opposition successfully drew centrist senators and federal deputies to comfortably override his veto on a sentencing bill passed last year.
Bolsonaro supporters expressed confidence in the outcome even before the voting began.
"This is a first and much awaited step by those who are afflicted. The next stage is full amnesty," said Senator Espiridião Amin, a Bolsonaro ally.
The bill passed by Congress last year reduces prison terms for several crimes, including those against the democratic rule of law and leading a coup when a person is convicted in both. The new legislation states that only the count carrying the highest sentence should be counted.
Bolsonaro allies in Congress said the move benefits not only the former president, but also supporters who were sentenced for destroying government buildings in Brasilia on January 8, 2023, in a riot that mirrored the assault on the US Capitol Hill two years earlier.
The vote hands Lula another significant defeat in Congress months before his bid for a fourth non-consecutive term.
"They want to release Bolsonaro, his jailed generals and stop federal police investigations that implicate them," said MP Lindberg Farias, a Lula ally. "This is a day of infamy."
Several politicians voting on Thursday spoke about October's presidential election. Four years ago, Lula beat Jair Bolsonaro by a narrow margin to return to the presidency. The president's rival in his bid for re-election will be Senator Flávio Bolsonaro, a son of the former president.
"If it is God's will, I will govern this country," said Flávio Bolsonaro during the vote. "I will hug you and take care of you, no matter what your political view is."
Lula is yet to comment about his defeat in Congress.