Powerful Somali warlord Hussein Mohammed Aideed has been named and sworn in as a deputy prime minister.
Hussein Aideed is the interior minister as well as deputy PM
His rival for the post, Mohammed Qanyare Afrah, has also been sworn in as national security minister.
The appointments complete the cabinet in the most serious attempt to impose order on a country carved up by rival militias during the past 13 years.
"Let us go back home and face the realities on the ground... and rebuild Somalia," the new prime minister said.
Mr Aideed, who is home affairs minister as well as third deputy prime minister, is the son of the late General Mohamed Farah Aideed, who US forces vainly tried to capture in 1993.
The swearing-in ceremony was held in neighbouring Kenya, because it remains too dangerous for them to be based in the capital, Mogadishu.
Deputy Prime Minister: Mohammed Abdullahi "Sifir" Jama
Deputy Prime Minister, Home Affairs Minister: Hussein Aideed (Mogadishu warlord)
Deputy Prime Minister: Shaykh Adan Madobe
Foreign Minister: Abdullahi Sheikh Ismail
Finance Minister: Salim Aliyow Ibrow
National Security Minister: Mohammed Qanyare Afrah (Mogadishu warlord)
Minister of Religious Affairs: Omar "Finish" Mohammed Mahmut (Mogadishu warlord)
Agriculture Minister: Hassan Mohamed Nur "Shatigudud" (Baidoa warlord)
Reconstruction Minister: Barre "Hirale" Aden Shire (Kismayo warlord)
Minister of Public Works and Housing: Osman Ali Ato (Mogadishu warlord)
"You cannot justify our presence in Kenya anymore. It cannot be accepted by the host country and international community as well," said Prime Minister Ali Mohammed Ghedi.
Hopes for success for this 13th attempt to form a government are higher because of the backing of neighbouring countries and the involvement of the main warlords.
But the BBC's Mohammed Olad Hassan in Mogadishu reports that some people are upset at the inclusion of so many warlords in the cabinet.
There have been some violent protests against the new team in parts of southern Somalia.
However, the challenges are enormous.
At least 50 people have been killed in the past five days in fighting in central Somalia, according to reports.
And on Monday, a top United Nations official described the scale of suffering in Somalia, which is being largely ignored by the donor community, as a "moral outrage".
Conditions across Somalia are "a moral outrage" says the UN
Jan Egeland, speaking after a visit to parts of Somalia, said that death rates were similar to Sudan's Darfur region, which is getting lots of international aid.
"The death rate among children in some parts of Somalia is five out of 10,000 people (per day)," said Mr Egeland, who heads the UN's emergency relief agency.
"We have to triple what we have today to attend to needs here like we are in Darfur. Life is worth as much in Somalia as it is in Darfur, or in Iraq."
Last year, funding for Somalia was $60m - half of what the UN requested, he said.