BERLIN — Conservative leader Friedrich Merz succeeded Tuesday in becoming Germany’s next chancellor, drawing applause and a palpable sense of relief in the parliament chamber after a historic loss in the first round of voting threatened the new government’s promises of stability.

No other postwar candidate for German chancellor has failed to win on the first ballot. The stunning but short-lived defeat sent shock waves throughout Europe and dragged down the stock market. The DAX, the index of major German companies, fell by 1.8% at one point.

The first round of voting, which was conducted by secret ballot, could affect Merz’s prospects for success and bring trouble to his coalition’s agenda, which includes reviving a stagnant economy and dealing with the rise of the far-right, anti-immigrant Alternative for Germany party.

As the most populous member state of the 27-nation European Union and the continent’s biggest economy, Germany is Europe’s diplomatic and economic heavyweight. Many had hoped Merz’s ascension would help the continent navigate the war in Ukraine and the confrontational trade policy of U.S. President Donald Trump.

“The whole of Europe, perhaps even the whole world, is watching this second round of elections,” Jens Spahn, the head of the center-right Union bloc in the German parliament, said before the final vote.