Antonis Samaras, the head of the conservative New Democracy party that came first in Sunday's election, has been sworn in as the new prime minister.
Samaras is at the helm of a three-party coalition that will uphold the country's international bailout commitments.
Wednesday's swearing-in took place just minutes after Greece's socialist PASOK party announced that the country has a new government, ending nearly seven weeks of political uncertainty which threatened to push Europe deeper into a financial crisis with global repercussions.
"I have the majority to form a long-term government of stability and hope," Samaras said, as the Greek economy struggles through a fifth year of recession.
Outgoing premier Panagiotis Pikrammenos told the new prime minister: "You have many battles ahead of you, both inside and outside Greece."
He is Greece's fourth prime minister in eight months.
Evangelos Venizelos, a former finance minister and PASOK head, said that details of the three-party coalition government were still being worked out and were expected to be finalised by the end of the day.
'Torturous' bailout deal
Samaras is a hawkish former foreign minister who has vowed to revise a "torturous" EU-IMF bailout deal and rid the country of undocumented migrants.
The 61-year-old conservative leader of the New Democracy party, which won a narrow victory in Sunday's elections against the anti-austerity Syriza party, was once one of the youngest politicians elected to the Greek parliament.
During his campaign, he promised to do everything to keep Greece in the euro but also argued for an easing of the terms of an EU-IMF bailout - a promise that could put him on a path to confrontation with foreign creditors.
|Click here to follow our Greece elections live blog
The move ends a protracted political crisis that had cast grave doubt over the country's future in Europe's joint currency and threatened to plunge the continent deeper into a financial crisis with global repercussions.
He will also face pressure from a public fed up with two years of austerity and from the many voters who only cast their ballots for him in a critical election to avert a disastrous Greek euro exit but actually dislike him.
Elected member of parliament at the age of 26 after an elite education, Samaras had a meteoric career but then suffered a downfall over his stance on the crisis with the former Yugoslav republic of Macedonia in the 1990s.
"PASOK socialists have also said they will back the government," Al Jazeera's John Psaropoulos said. "So technically we now have 179 MPs from three parties forming the parliamentary basis for a coalition."
Greek political parties have also agreed to name Vassilis Rapanos, National Bank chairman, as finance minister of a conservative-led coalition being formed, a party official said on Wednesday, confirming a report on state television.
The new government still has massive challenges ahead: it must deliver on pledges by its predecessors to generate huge new savings, privatise publicly owned companies and real estate, cut about 150,000 civil service jobs in coming years and open restricted professions to competition.
"We will do everything in our power to lift our people out of the crisis as soon as possible. This is what I'll be asking for when I see the new cabinet tomorrow morning," Samaras said as he left the presidential mansion after the swearing-in ceremony.
All three parties broadly back Greece's pledges to bailout creditors for further austerity and reforms, although they have
pledged to renegotiate some of the terms for the rescue loans.
Greece has been dependent on the loans from other eurozone countries, notably Germany, and the IMF since May 2010.
In return, it has imposed deep spending cuts, reduced salaries and pensions, and repeatedly raised taxes.
The measures have left the country struggling through a fifth year of recession, with unemployment rising to above 22 per cent and tens of thousands of businesses shutting down.
Later on Wednesday, Chancellor Angela Merkel of Germany called Samaras to wish him "luck and success for the difficult work ahead of him" and to invite him to Berlin, Steffen Seibert, German government spokesman, said.
Source: Al Jazeera and agencies