Keeping Brazil's top job is not an easy task in a country where two presidents have been impeached in the past three decades and some of the most powerful names in business and politics are currently behind bars.
Yet Michel Temer, the man who ascended to Brazil's presidency by surprise last year, seems to have a special talent for it.
On Wednesday, he managed to get 251 votes against 233 for his opponents in the lower house of Congress and so stop a corruption investigation that would have forced him to step down immediately for at least six months.
And it is not the first time he has succeeded in convincing his fellow politicians to spare him. In August, he survived a similar vote.
Mr Temer is the first president in Brazilian history to have charges brought against him while still holding the top job.
And the allegations against him are serious. He is accused of being the head of a criminal organisation and of trying to obstruct the course of justice.
Prosecutors say that back in 2006, when he was still a congressman, he created a bribery scheme which lasts to this day.
His political group allegedly funnelled over 587m reais ($180m, £137m) from state-run institutions such as Petrobras and the Brazilian Lottery into the pockets of lawmakers.
He is also accused of pressuring billionaire businessman Joesley Batista into buying the silence of two key witnesses that are cooperating with investigators from jail.
Mr Temer has denied all the allegations. He says he is the victim of "coup plotters", who he claims are trying to remove him from office.
Ironically, his predecessor in office, Dilma Rousseff, said the same about Mr Temer when she was facing allegations of illegally manipulating government accounts which eventually led to her impeachment.
Prosecutors say they have a mountain of evidence against Mr Temer.
There is video footage of a close aide of President Temer receiving bags stuffed full of millions of reais in a restaurant in Sao Paulo.
And two key witnesses have described how the Brazilian president allegedly kept some of the bribe money for himself.
Prosecutors even have a recording of Mr Temer listening to Joesley Batista brag about bribes the latter paid to judges and witnesses.
Ms Rousseff was impeached over much less severe allegations last year. But Mr Temer is proving himself to be far more skilled in the art of political survival.
For one thing, the economy is helping him. While Ms Rousseff left office at the height of Brazil's worst recession in history, the country is now finally showing modest signs of recovery.
It is a reversal for which Mr Temer is claiming full credit. Last week, he wrote a letter to lawmakers warning that a probe into his affairs would revert the economic recovery.
His government has also aggressively bargained with lawmakers, increasing the budget by 12bn reais upon their recommendation.
He also announced an easing of the anti-slavery laws and privatisation programmes which some lawmakers had opposed.
Carlos Melo says that Mr Temer is not using legal arguments to defend himself, but "pragmatically using his pen and the Brazilian budget to win".
The political scientist at Insper Business School calls this move "alarming, especially at a time when Brazil's budget problems are partly to blame for the country's economic recession".
Mr Temer has also been skilful at winning the hearts and minds of his fellow politicians.
His argument that he is the target of a witch hunt against politicians has struck a chord with his peers facing similar allegations.
Fifty-nine percent of the lawmakers who sided with President Temer in the vote in August on whether he should face trial are themselves under investigation.
While Mr Temer remains remarkably strong in the corridors of power in Brasilia, polls suggest he has the worst approval ratings in history.
So why are Brazilians not taking to the streets in their millions like they did to protest against Dilma Rousseff?
Mr Melo believes that Brazilian society today is "disenchanted and demobilised". "It seems they were content with simply getting rid of Dilma," the political scientists says.
Moreover, many of the organisers behind the last year's protests against Dilma Rousseff were right-wing movements which back some of Mr Temer's economic reforms.
Groups such as Movimento Brasil Livre (Free Brazil Movement) and Vem Pra Rua (Come into the street), which campaigned against corruption and helped bring down Ms Rousseff, are now conspicuously absent from the streets.
There is a sense among them that any demonstration against Mr Temer may increase support for the left-wing Workers' Party and its candidate in next year's general election, former President Luiz Inacio Lula da Silva.
They argue that a return to power of the Workers' Party would also mean a return to their unorthodox economic policies which many blame for Brazil's economic collapse.
With Mr Temer again winning a reprieve from Congress, the president will continue to push for his programme of economic reforms.
When he came to power 17 months ago, Mr Temer promised to pull Brazil out of recession and into a new future.
He may yet achieve that if the current modest economic recovery proves to be lasting.
But he is also earning himself a place in the history books as a president who ruthlessly used every available trick to avoid trial just as Brazil was stepping up its fight against corruption.