With all votes counted, Germany's Social Democrats (SPD) have won the Bundestag election ahead of Chancellor Angela Merkel's conservative CDU/CSU bloc, according to the federal election commissioner's official website.
The SPD got to 25.7 per cent, its best result in years, while Merkel's CDU/CSU bloc fell to a record low of 24.1 per cent after her many years in office.
Earlier, both main candidates to be the next German chancellor, Social Democrat (SPD) Olaf Scholz and Christian Democrat (CDU) Armin Laschet, said they want to form the next government.
The next cabinet will be the first in 16 years not led by Merkel after her four terms in the top job.
Her favoured successor, Laschet, is however fighting for his political survival after voters expressed their displeasure, causing the CDU and its Bavarian sister party, the Christian Social Union (CSU) to both slump to their worst-ever election result.
The CDU/CSU and the centre-left SPD have been in a "grand coalition" for the last four years.
To thundering applause at party headquarters in Berlin, Scholz expressed his delight at the SPD's "great success," a turnaround for a party that had long been in the doldrums.
In the last elections the party won 20.5 per cent, and it had seen its fortunes wane further while in coalition with the CDU/CSU.
But Scholz ran a successful campaign that underscored his competence and maximized his personal popularity with voters. He campaigned for a higher minimum wage, tax reductions for middle and low earners and new public investment.
Voters wanted a change
He said that voters had made it clear that they wanted a change in government - and for the next chancellor to be him. "This is a mandate," he said.
He wanted to wrap up coalition negotiations by Christmas, he said later in a television debate.
It took nearly half a year for a new government to be formed after the last federal elections in 2017, although the process is usually faster than this.
The SPD's thin margin of victory meant that leading conservatives on Sunday were not giving up hope of forming the next government.
Laschet earlier also laid a claim to the chancellorship. "We will do everything in our power" to form a coalition led by the CDU/CSU, he said.
"We cannot be satisfied" with the result, Laschet added. The bloc's share of the vote sunk dramatically from the 32.9 per cent it won in 2017.
CDU secretary general Paul Ziemiak lamented what he described as "bitter losses," but said he still wanted to see a coalition featuring the CDU.
The focus in the coming days will be on the individual parties as they figure out what deals they would be prepared to make to be part of a governing coalition in Europe's biggest economy.
The SPD could work with the Greens, who won 14.8 per cent, and pro-business Free Democrats (FDP), who captured about 11.5 per cent. A coalition with the hard-left Die Linke has been all but ruled out due to the pacifist party's poor election showing, at around 4.9 per cent.
The SPD could also rejoin a coalition with the CDU/CSU, but both sides have set themselves against this in recent weeks.
The CDU/CSU bloc could lead a coalition with the FDP and the Greens - something backed on Sunday by influential Bavarian leader Markus Soeder.
But this exact coalition - a so-called 'Jamaica' coalition as the colours of the parties match the Jamaican national flag - was attempted in 2017, only to fall apart in dramatic fashion with the withdrawal of the FDP.
For the first time in its history, the Greens put forward a candidate for chancellor this year, but Annalena Baerbock saw her popularity slide during the campaign.
Her party still has a good chance of entering a three-way coalition with either the conservatives or the SPD.
On Sunday evening she praised her party's "historically best result" - its highest previous result was 10.7 per cent in 2009.
She admitted to having made mistakes during the campaign that saw her party's vote share slide after holding the top spot early on.
The far-right AfD meanwhile became the strongest party in Thuringia in eastern Germany for the first time at 24.0 per cent.
The party, which is being monitored by domestic intelligence (BfV) because of right-wing extremist tendencies, got 24.6 per cent in Saxony but slipped to 10.3 per cent at the national level - fifth place.
Turnout in Sunday's federal election was between 76 and 77 per cent, according to projections. Turnout at the last election in 2017 was 76.2 per cent.
Outgoing chancellor Merkel is set to retire from politics as soon as a new government is in place.
She is the country's second-longest serving leader, after Helmut Kohl, who took Germany through reunification.
If coalition negotiations run until next year, she will eclipse even Kohl's time in office.