The PM's refusal to quit had created a potential deadlock in the fight against the Islamic State (IS) militants who have forced thousands of Christians to flee their homes in the north of the country.
But last night, Mr al-Maliki gave his support on state television to the Iraqi Parliament's deputy speaker, the Shi'ite Haider al-Abadi, to form a government.
Flanked by Mr al-Abadi and other Shi'ite politicians, Mr Maliki spoke of the grave "terrorist" threat from Sunni militants before giving up on his fight to stay on.
He told viewers: "I announce before you today, to ease the movement of the political process and the formation of the new government, the withdrawal of my candidacy in favour of brother Dr Haider al-Abadi.
The move is likely to please the Sunni minority which dominated under Saddam Hussein, but was then sidelined by the relative unknown who came to power in 2006.
Critics accused Maliki of being an authoritarian leader with a sectarian agenda that drove Sunnis, including heavily-armed tribes, into the Islamic State camp and revived a civil war.
Last night's announcement came shortly after President Barack Obama said the US has broken the IS militants' siege and helped rescue thousands of civilians.
Mr Obama said it was unlikely more air drops of food and water would be needed, but that air strikes against the group would continue. He said the US would work with other governments to provide humanitarian relief "wherever we have capabilities" and could reach those in need, even as American warplanes continue a limited campaign of air strikes.
A US military and civilian team of 16 people spent Wednesday on top of Sinjar Mountain to assess conditions and see how many Iraqis needed to be evacuated. They reported that the number of trapped Iraqis was about 4,000 - far fewer than anticipated - and that food and water had reached many.