Constitutional Court had ordered Rajaonarimampianina to form a government of national unity with a "consensus prime minister".
Ruling triggered fierce debate between the government and the opposition over its interpretation.
Madagascar's president announced Monday that a new government had been appointed following a court ruling which called for a "consensus" administration to resolve a political crisis sparked by electoral reform.
The Indian Ocean nation has been rocked by ongoing anti-government protests that began over new laws that the opposition said sought to bar their candidates from taking part in elections scheduled for later this year.
"The government of (Prime Minister) Christian Ntsay has now been put in place after several rounds of negotiations," President Hery Rajaonarimampianina told reporters at his official residence.
The Constitutional Court had ordered Rajaonarimampianina to form a government of national unity with a "consensus prime minister" to avert a full-blown crisis.
The president said the appointments "respected" the ruling which required the ministries to be allocated to the country's parties to reflect the composition of parliament after polls in 2013.
However, the ruling triggered fierce debate between the government and the opposition over its interpretation.
Both sides say they hold the majority in parliament, where many legislators have switched allegiances since 2013.
Several key ministries including defence and finance remain in the hands of the president's HVM party, although others like fishing and tourism have gone to opposition figures under the deal.
On June 4 he appointed non-partisan technocrat Christian Ntsay, 57, as prime minister as part of an agreement with part of the opposition to obey the court ruling.