The Brazilian Congress has voted not to put President Michel Temer on trial for corruption.
Opposition lawmakers in the lower house of Congress failed to obtain the two-thirds majority needed to send the case to the Supreme Court.
Mr Temer welcomed the vote as "clear and incontestable".
The president has been accused of receiving $12m (£9m) in bribes from the boss of a giant meatpacking firm, JBS. He has denied the allegation.
In the 513-seat chamber, 263 voted against the motion to send the president for trial and 227 voted in favour, well below the 342 needed for the motion to pass.
"With the support the lower house has given me, we will pass all the reforms that the country needs," President Temer said, after the vote.
"Now it is time to invest in our country.Brazil is ready to start growing again."
He vowed to complete his term of office, which ends in December 2018.
The Congress session was marred by scenes of chaos and angry exchanges.
Lawmakers shouted abuse, pushed each other and threw fake bank notes at their opponents.
Left-wing Congressman Ivan Valente, of the Socialism and Liberty Party, demanded the ousting of Mr Temer and the holding of new elections.
"The Brazilian people do not want Temer, the Brazilian people want direct elections. We do not want to change six for half-a-dozen. Out with Temer! Direct (elections) now!" he said.
The lengthy session descended into chaos earlier, when both sides traded accusations of corruption.
Pro-government lawmakers displayed inflatable dolls depicting former President Luiz Inacio Lula da Silva as a prisoner.
He was sentenced last month to nine years and six months in jail and is facing other charges of corruption.
Lula says all the accusations against him are politically-motivated.
Mr Temer's supporter argued his dismissal would cause instability and damage Brazil's ailing economy.
"I am in favour of all investigations, but the moment we are living in is very delicate and we need to recover the economy," said Luiz Claudio from the centre-right Republic Party.
Mr Temer became president last year following the impeachment of his predecessor, Dilma Rousseff.
She was found guilty of tampering with the government accounts in order to hide a growing deficit ahead of her re-election in 2014.