Xanana Gusmao, the East Timorese president, had named Ramos-Horta on Saturday as the person to replace Mari Alkatiri, who resigned last month as prime minister after failing to stop violence in the country and amid allegations that he formed a hit squad to kill his political opponents.
"I swear by God to carry out my duties as prime minister," said Ramos-Horta on Monday, while placing his hand on a copy of the country's constitution at a presidential palace ceremony in the country's capital, Dili.
President Gusmao announced the decision to appoint Horta after holding talks with Alkatiri's ruling Fretilin party.
The party provided Gusmao with a list of four candidates - among them Ramos-Horta, the outgoing foreign minister who won the 1996 Nobel Peace Prize for championing the cause of East Timor's independence.
Ramos-Horta will serve as prime minister until new elections are held in May next year.
The president's office, where the ceremony was held, was guarded by around 50 Australian peacekeepers, who form part of a 2,200-strong force sent to the country after violence erupted in May.
Trouble began when Alkatiri sacked about 600 members of the 1,400-strong army in March for protesting against discrimination.
At least 30 people were killed and 150,000 made homeless in the ensuing violence, the worst to hit the former Portugese colony since independence from 24 years of Indonesian rule in 1999.