Guatemalan President Otto Perez Molina has resigned hours after a judge issued a warrant for his arrest.
Prosecutors accuse Mr Perez Molina of masterminding a scheme to defraud the customs service of millions of dollars. He denies the allegations.
On Tuesday, Congress stripped him of his immunity from prosecution, a first in the Central American nation.
A spokesman said Mr Perez Molina had decided to step down to "confront the proceedings against him".
Mr Perez Molina's resignation comes just days before Sunday's presidential election, in which he was barred from standing under constitutional rules.
Analysis: Katy Watson, BBC News, Central America correspondent
For weeks now Guatemalans have been chanting "fuera" (out).
They shouted because more than anything they wanted President Perez Molina to resign.
They were outraged at these most recent corruption scandals and while corruption has always been present - and even tolerated - in Guatemala, people had had enough.
Their voices have now been heard. Guatemalans feel this is their moment, that for once they have been listened to.
On a day that until recently they never thought they would see, people on the streets feel empowered.
Vice-President Alejandro Maldonado is expected to govern until the new president is sworn in on 14 January.
Mr Maldonado has only been in the post since mid-May, when his predecessor Roxana Baldetti resigned.
Ms Baldetti is accused of involvement in the same corruption scheme which Mr Perez Molina allegedly masterminded.
Investigators say the scheme, dubbed La Linea, or The Line, involved businesses paying bribes to government officials and custom officers in return for being allowed to evade import duties.
The corruption scandal has triggered a series of mass protests in Guatemala and widespread calls for Mr Perez Molina to resign.
But until Wednesday night, the president had stood firm, saying he would serve out his term.
His spokesman said Mr Perez Molina had handed in his letter of resignation just before midnight local time.
Congress still has to approve his resignation before it comes into force.
Local media said Mr Perez Molina's current whereabouts were unknown.
On Tuesday, a judge barred him from leaving the country "as a precautionary measure".
Earlier this week, Mr Perez Molina said he would be "very respectful and submit himself to the rule of law".