Germany's center-left Social Democrats (SPD) have narrowly won the country's federal elections Sunday, beating the party of outgoing Chancellor Angela Merkel, according to preliminary results, BBC News reported.

The SPD secured 25.7% of the vote, while the ruling conservative CDU/CSU bloc gained 24.1%.

The Greens achieved the best result in their party's history, coming in third with 14.8% of the ballot.

A coalition must now be created to form a government.

SPD leader Olaf Scholz earlier said his party had a clear mandate to rule, as his party started to edge into the lead.