Newly re-elected Iraqi President Jalal Talabani has reappointed Nouri Maliki, a Shia, as prime minister.
The move comes after eight months of political deadlock which followed inconclusive elections in March.
But the event was marred by a walkout by al-Iraqiyya, the main Sunni-backed alliance led by former PM Iyad Allawi.
It said Mr Maliki had reneged on an agreement to reinstate four Sunni leaders who had been banned for alleged ties to Saddam Hussein's Baath party.
US President Barack Obama welcomed the progress that Iraq had made in recent days.
"The president is encouraged by the substantial progress that has been made in forging an inclusive government that represents the Iraqi people and the results of this year's election," said a White House statement.
The White House added that the US president had spoken to several Iraqi leaders in the run-up to the parliamentary session.
'Stabbed in the back'
Iraq's parliament convened after a delay of several hours on Thursday.
Their first act was to hold secret ballot which appointed Osama al-Nujaifi - a Sunni Arab member of Mr Allawi's al-Iraqiyya coalition - as speaker. He was previously governor of Nineveh province.
MPs were then due to vote on reappointing Mr Talabani, leader of the Patriotic Union of Kurdistan (PUK), as president. But before the vote could be held, about a third of the al-Iraqiyya MPs - including Mr Nujaifi and Mr Allawai - walked out of the parliament.
The BBC's Jim Muir in Baghdad says the al-Iraqiyya members had wanted parliament to pass a motion to remove the stigma of Baathism which had barred four of the coalition's key figures from taking political office.
Although not opposed to Mr Talabani's re-election itself, they had wanted the motion to be passed before the election of the president.
"We boycotted the session because we showed good intentions to others, but they stabbed us in the back," Saleh al-Mutlak, one of the barred lawmakers, told the AFP news agency.
"We will not return without international guarantees," he added, but gave no further details.
But despite the walk-out, the parliamentary session continued and MPs went on to re-elect Mr Talabani.
"Today is the day of victory. The victory of the true Iraqi will," Mr Talabani told parliament.
As had been agreed in the deal reached on Wednesday, Mr Talabani then handed the task of forming a government to the largest coalition, the National Alliance - a merger of Mr Maliki's State of Law coalition and the Iraqi National Alliance of the radical Shia cleric Moqtada Sadr.
Mr Maliki now has a month to put together a cabinet, during which efforts will be made to draw Mr Allawi back into the process, says our correspondent.
Under the power-sharing deal - struck late on Wednesday - Mr Allawi will head a new "National Council for Strategic Policies". Al-Iraqiyya will also get the foreign ministry.
Al-Iraqiyya won two more seats than State of Law in March's election, but neither had enough seats to form a government.
The tide turned for Mr Maliki in early October when the Iraqi National Alliance announced that it would back him for a second term.
Our correspondent says that many Iraqis are now cautiously hopeful that they are on the road to a stable government which includes all the main factions and could turn the corner to a better future for the whole country.