Outside the assembly, hundreds of Maoist supporters celebrated, many waving hammer-and-sickle flags.
His supporters put garlands of flowers around his neck and daubed his forehead with vermilion.
Some shouted: "Long live the Maoists, long live Prachanda".
'Day of pride'
"Today is a day of pride and it will be written with golden letters in the history of the nation," Baburam Bhattarai, Prachanda's colleague who is seen as the number two in the Maoist hierarchy, said.
Tucked in the Himalayas between China and India, Nepal occupies an area of 147,000 sq km, with a population of 26.4 million
Nearly one-third of its people live on an income of less than a dollar a day
Eighty per cent of Nepalis are Hindus
Nepal was the world's last Hindu kingdom, before declaring itself officially secular in 2006
He also said that said Maoist politicians would no longer hold any posts in the Maoist rebel army and would return property seized by them during the war.
Prachanda, whose given name is Pushpa Kamal Dahal, led a decade-long insurgency to overthrow the monarchy - a war that cost the lives of at least 13,000 people and devastated one of the world's poorest countries.
The Maoists signed a peace deal with mainstream parties in 2006, vowed to renounce violence and steered his party, the Communist Party of Nepal - Maoists, to victory in elections to a new constitutional assembly in April.
The Maoists then won a special assembly election but did not get a parliamentary majority, leaving Nepal struggling to form a government four four months after the polls.
The Nepali Congress party, which has ruled Nepal for most of the past 18 years, has refused to join the Maoists in government.
"The peace process has not concluded yet, the country must be free from violence and fear," warned Ramchandra Poudel, a senior Nepali Congress leader.
The Nepali Congress is the second biggest party in the assembly.
Ban Ki-moon, the UN secretary general, later congratulated Prachanda on his election and urged all parties to cooperate with the new government.
"The Secretary General warmly congratulates Mr Pushpa Kamal Dahal [Prachanda] on his election as the first prime minister of the Federal Democratic Republic of Nepal," his office said in a statement.