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.
Julia Carneiro, BBC News, Rio de Janeiro
You know there’s something serious happening in Brazil when the prime time soap opera is cancelled.
In its place, the voting session in Congress was shown on the main TV channel, with no lack of drama – from pushing and shoving to fake money flying in the air.
After the outcome, Brazilians turned back to the evening’s live football match.
A recent poll suggested that more than 80% of the population wanted the investigations to continue, but the outcome of the vote in Congress was expected.
Over the past weeks, Brazilians followed news of Mr Temer’s manoeuvres to muster support to save his government.
Unlike his impeached predecessor, Dilma Rousseff, Mr Temer is no beginner in politics, and showed his ability in forging alliances – even if this includes promising roles in ministries, funds for lawmaker’s projects and other benefits.
President Temer is currently approved by only 5% of the population, but still has the backing of political elites and businesses due to the economic reforms he is pursuing – and has so far managed to resist the political scandal.
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.
- All you need to know about Brazil’s corruption scandals
- Temer steps out of the shadows to lead Brazil
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.