BERLIN (Reuters) -- Germany's Social Democrats narrowly won Sunday's national election, projected results showed, and claimed a "clear mandate" to lead a government for the first time since 2005 and to end 16 years of conservative-led rule under Angela Merkel.
The center-left Social Democrats (SPD) were on track for 26.0% of the vote, ahead of 24.5% for Merkel's CDU/CSU conservative bloc, projections for broadcaster ZDF showed, but both groups believed they could lead the next government.
With neither major bloc commanding a majority, and both reluctant to repeat their awkward "grand coalition" of the past four years, the most likely outcome is a three-way alliance led by either the Social Democrats or Merkel's conservatives.
Agreeing a new coalition could take months, and will likely involve the smaller Greens and liberal Free Democrats (FDP).
"We are ahead in all the surveys now," the Social Democrats' chancellor candidate, Olaf Scholz said in a round table discussion with other candidates after the vote.
"It is an encouraging message and a clear mandate to make sure that we get a good, pragmatic government for Germany," he added after earlier addressing jubilant SPD supporters.
The SPD's rise heralds a swing left for Germany and marks a remarkable comeback for the party, which has recovered some 10 points in support in just three months to improve on its 20.5% result in the 2017 national election.
Scholz, 63, would become the fourth post-war SPD chancellor after Willy Brandt, Helmut Schmidt and Gerhard Schroeder. Finance minister in Merkel's cabinet, he is a former mayor of Hamburg.
Scholz's conservative rival Armin Laschet, signalled his bloc was not ready yet to concede, though his supporters were subdued.
"It hasn't always been the the first-placed party that provided the chancellor," Laschet, 60, told the round table. "I want a government where every partner is involved, where everyone is visible - not one where only the chancellor gets to shine," he said in an early attempt to woo smaller parties.
Schmidt ruled in the late 1970s and early 1980s in coalition with the FDP even though his Social Democrats had fewer parliamentary seats than the conservative bloc.
Attention will now shift to informal discussions followed by more formal coalition negotiations which could take months, leaving Merkel in charge in a caretaker role.
Scholz and Laschet both said they would aim to strike a coalition deal before Christmas.
Merkel plans to step down after the election, making the vote an era-changing event to set the future course of Europe's largest economy.
She has stood large on the European stage almost since taking office in 2005 - when George W. Bush was U.S. president, Jacques Chirac in the Elysee Palace in Paris and Tony Blair British prime minister.
After a domestic-focused election campaign, Berlin's allies in Europe and beyond may have to wait for months before they can see whether the new German government is ready to engage on foreign issues to the extent they would like.
A row between Washington and Paris over a deal for Australia to buy U.S. instead of French submarines has put Germany in an awkward spot between allies, but also gives Berlin the chance to help heal relations and rethink their common stance on China.
On economic policy, French President Emmanuel Macron is eager to forge a common European fiscal policy, which the Greens support but the CDU/CSU and FDP reject. The Greens also want "a massive expansion offensive for renewables".
"Germany will end up with a rather weak chancellor who will struggle to get behind any kind of ambitious fiscal reform at the EU level," said Naz Masraff at political risk consultancy Eurasia.
Whatever coalition ends up in power, Germany's friends can at least take heart that moderate centrism has prevailed, and the populism that has taken hold in other European countries failed to break through.
The projected results for ZDF showed the far-right Alternative for Germany (AfD) on track for 10.5%, worse than four years ago when they stormed into the national parliament with 12.6% of the vote, and with all mainstream groupings ruling out a coalition with the party.