BERLIN—Germany’s center-left Social Democrats held a thin lead over their conservative rivals in Sunday’s national election, according to exit polls, potentially heralding a leftward shift in the German government after 16 years of conservative rule under Chancellor Angela Merkel.

The result, if confirmed, means Olaf Scholz, the 63-year-old SPD candidate and finance minister in Ms. Merkel’s government, would be the leading candidate to become the next chancellor.

The...

BERLIN—Germany’s center-left Social Democrats held a thin lead over their conservative rivals in Sunday’s national election, according to exit polls, potentially heralding a leftward shift in the German government after 16 years of conservative rule under Chancellor Angela Merkel.

The result, if confirmed, means Olaf Scholz, the 63-year-old SPD candidate and finance minister in Ms. Merkel’s government, would be the leading candidate to become the next chancellor.

The exit polls are close, and the results could still change in the course of the evening, but the ascent of a center-left government in Europe’s biggest country could have important ramifications for Europe, given Germany’s traditional leadership in the region and the influence Berlin has on European Union policies.

An exit poll by the ZDF public broadcaster showed the SPD with 26% of the vote, followed by Ms. Merkel’s conservative bloc with 24%. Another poll, by the ARD public broadcaster, showed the two parties neck-and-neck.

While Mr. Scholz is a member of the current government and has stressed continuity in his election campaign, he has signaled some openness to allowing the European Union to spend and raise debt. Germany has traditionally opposed such a policy because it thinks only democratically elected parliaments should have a say in such matters and that such a construct would lead to overspending and over-borrowing.

People lined up Sunday in Berlin for the national election, with the results likely pointing toward complex negotiations to form a coalition government.

Photo: wolfgang rattay/Reuters

Germany’s relationship with the U.S. has cooled under Ms. Merkel, something that isn’t expected to change under Mr. Scholz as chancellor.

Because no party has an outright majority, however, the next government’s policies ultimately will depend on which parties enter the ruling coalition. It could be months before a new government takes power. Barring a change in the results, the SPD will lead negotiations with other parties to form a coalition government, which is likely to include three parties for the first time since the end of World War II.

Ms. Merkel will remain as caretaker head of government during the coalition talks. A new government must win the support of a majority of parliamentarians. Should Mr. Scholz fail to forge a coalition, others may attempt to do it instead.

The ZDF exit polls showed the Greens with 14.5%, and the pro-market Free Democrats with 12%. The hard-left Left Party was estimated to have received 5%, and the far-Right Alternative for Germany 10%, but the latter will be kept out of government and any negotiations because all other parties have pledged never to go into coalition with it.

The election result is a bitter setback for the conservatives, who were running without Ms. Merkel on their ticket for the first time since 2002 and saw their share of the vote drop around nine points from an already historic low in 2017.

How much the leftward swing in the election result translates into new policies for Germany will depend on the coalition negotiations. The final policy agreement, which can be highly detailed and run in the hundreds of pages, will feature a mix of each party’s priorities.

Mr. Scholz campaigned on a social-justice ticket focused on increasing the minimum wage, building affordable housing, increasing taxes for the upper-middle class and stabilizing the pay-as-you-go pension system.

A voter cast a ballot Sunday in Potsdam, Germany, in the country’s national election.

Photo: Sean Gallup/Getty Images

The Greens, which are near-certain to be his second-biggest partner, have made their participation in any government conditional on radically reducing the country’s C02 emissions and subsidizing a green transformation of the economy. They call for an annual stimulus for green subsidies of over 50 billion euros (equivalent to more than $58 billion) on top of existing public expenditure.

The pro-business FDP, likely to join a ruling alliance as the smallest partner, has said would prevent any tax increases. If Mr. Scholz opts for a coalition with them, it is likely that the government’s social and climate agenda will rely more on borrowing from the markets.

But coalition talks will be complex, warned Albrecht von Lucke, a political analyst, because no single party apparently emerged with a clear mandate. While such fragmentation has become normal in smaller nations ruled by relatively unstable coalitions such as The Netherlands and Sweden, EU’s largest and preeminent country could become difficult to govern.

“This is a fundamentally new situation for Germany: there has been an enormous erosion of the large parties,” he said.

If the coalition talks extend beyond Dec. 17, Ms. Merkel will have surpassed her former mentor Helmut Kohl as the longest-serving German chancellor in the modern era.

Write to Bojan Pancevski at bojan.pancevski@wsj.com