The narrow victory for Dr Allawi's Iraqiya coalition is not a guarantee that he will become Prime Minister.
By Andrew North
BBC News, Baghdad
Is Iyad Allawi the secular doctor to heal Iraq's wounds?
It was the British-trained surgeon's success in winning votes from both sides of Iraq's sectarian divide that delivered his narrow two-seat victory.
First though he will have to prove his bargaining skills in Iraq's political bazaar, if he is to forge a coalition government from its disparate factions.
The Iraqiya list's victory was a surprise, Mr Maliki had an early lead
Prime Minister Nouri Maliki remains in the race and may yet hang on to his job by appealing to his fellow Shias.
He is talking to the same groups, trying to build his own coalition, while also insisting on a recount - despite the UN declaring the elections credible.
Mr Maliki - who remains caretaker prime minister in the meantime - says he will pursue his challenge by legal means.
The Americans are watching closely, with their withdrawal plans dependent on a relatively trouble-free outcome to the elections.
It is widely thought they would like Dr Allawi to win, although they are being careful to voice no preference.
Mr Allawi has deep ties with the Americans and also with Britain - he worked with both the British and US intelligence services against Saddam Hussein.
Dr Allawi's narrow two-seat victory over Mr Maliki and his State of Law bloc was an astonishing comeback.
He was shunned by voters as an American puppet in the last general elections, after serving as the first post-US invasion prime minister.
A secular Shia who has criticised Iranian influence on Iraq, he timed his return well.
By allying with Sunni groups, he was able to tap into their sense of being marginalised by Mr Maliki's Shia-dominated government and its perceived leanings towards Tehran.
Yet while Iraq's Sunni minority delivered most of his support, Dr Allawi also succeeded in reaching across the sectarian divide and picking up many votes from Shias disenchanted with the prime minister.
A closer look at the results tell the story.
In the southern Shia provinces where Mr Maliki won the bulk of his seats, Dr Allawi still got 10 for himself - holding off competition from other Shia parties too.
Mr Maliki could not match this cross-sectarian appeal in the predominantly Sunni areas where Dr Allawi did best, winning just one.
Crucially, Dr Allawi also picked up nearly as many seats in Shia- dominated Baghdad as his opponent - effectively sealing his victory.
This still only gave his Iraqiya bloc 91 seats - a long way short of the 163 it needs to form a majority in Iraq's parliament.
Dr Allawi was quick to say he would work with any party, including the State of Law.
"Our talks with different blocs are already more advanced than many realise," said Rend Rahim, one of his MPs.
With the State of Law meeting the same groups, this is a bidding war between the two blocs.
It is the Kurds and the Iraqi National Alliance, the second largest Shia grouping, now dominated by the cleric Moqtada Sadr, who will play the decisive role.
Together they wield over 110 seats, more than enough to give Dr Allawi or Mr Maliki control of parliament.
The radical Shia cleric Moqtada Sadr may yet become a kind of kingmaker
The Kurds have had differences with both leaders, so they could go either way.
After Mr Maliki cracked down on Moqtada Sadr's Mehdi army militia, the two former Shiite allies fell out badly.
But the prime minister has already sent people to talk to Mr Sadr, who is in Iran.
Tehran, which has stayed noticeably quiet so far about Dr Allawi's victory, is likely to encourage such a make-up.
Among Mr Sadr's supporters in his Baghdad stronghold of Sadr City, many would prefer this outcome too, despite the past.
Keeping Shias in power is seen as more important.
This is where Iraq's sectarian politics are still very much alive and Dr Allawi's Sunni support base counts against him.
There are suspicions too about the past-Baathist affiliations of Dr Allawi - he once worked closely with Saddam Hussein, before turning against him - and others in his Iraqiya list.
Since Britain departed in 1932 no Iraqi leader has left office peacefully
A body responsible for vetting candidates for Baath party ties could also derail Dr Allawi's plans.
It is threatening to disqualify several Iraqiya representatives in addition to those it controversially barred before the 7 March vote.
Mr Maliki has quietly put another hurdle in his rival's way - securing a ruling from Iraq's supreme court which gives the bloc with the largest number of seats when parliament re-convenes, rather than from the election, the first chance to form a government.
Iraqiya disputes this interpretation of the court decision, but it could give Mr Maliki the time he needs to make up his two-seat gap.
After such a tight race, it is hardly surprising he is not giving up easily.
He is a politician, after all, with many people depending on his patronage.
A recount looks unlikely, after the election commission rejected similar demands from several other parties, impressing many Iraqis with its independent stand.
So far, the political process has proved more robust than many expected, despite seven years of bloodshed and turmoil.
But if Mr Maliki clings onto power because of Shia solidarity, there is a risk of Iraq's minority Sunnis again feeling disenfranchised and things going backwards again.
Since 1932 when Britain departed the country it created, no Iraqi leader has left office peacefully.
Only one person could claim to be a slight exception - Iyad Allawi, after he handed over power in 2005.
But that was hardly a normal situation, with Iraq under full American occupation and descending into sectarian war.
So an orderly transfer of power could be just as significant as Dr Allawi winning - if he eventually becomes prime minister.
Al-Iraqiyya (Iraqi National Movement): Nationalist bloc led by former PM Iyad Allawi, a secular Shia. Includes Vice-President Tariq al-Hashemi, a Sunni Arab, and senior Sunni politician Saleh al-Mutlaq
State of Law: Led by Prime Minister Nouri Maliki and his Shia Islamist Daawa Party, the alliance purportedly cuts across religious and tribal lines. Includes some Sunni tribal leaders, Shia Kurds, Christians and independents
Iraqi National Alliance (INA): Shia-led bloc includes followers of the radical cleric, Muqtada al-Sadr, the Supreme Iraqi Islamic Council (SIIC), and the Fadhilah Party, along with ex-PM Ibrahim Jaafari and Ahmad Chalabi
Kurdistan Alliance: Coalition dominated by the two parties administering Iraq's semi-autonomous Kurdish region - the Kurdistan Democratic Party (KDP) and Patriotic Union of Kurdistan (PUK), led by President Jalal Talabani