Merkel's election by Germany's lower house of parliament, the Bundestag, ends 171 days of waiting after Germany's national popular election on September 24, 2017. Merkel was elected by deputies from her own conservative CDU-CSU and her junior coalition partners, the Social Democratic Party (SPD).

In all, 364 members of the Bundestag voted for Merkel, while 315 voted against her. There were nine abstentions, and 21 parliamentarians were either absent or didn't cast valid ballots. That's hardly a ringing endorsement considering that the grand coalition accounts for 399 votes in the Bundestag.

After the vote, Merkel headed over to Berlin's Bellevue Palace to be sworn in by German President Frank-Walter Steinmeier.

Merkel's conservatives won September's election, taking 33 percent of the vote, ahead of the SPD with 20.5 percent. But both of those figures were down sharply from 2013, due in part to the rise of the far-right populist Alternative for Germany (AfD) party, which took 12.6 percent of the vote.

Read more: 5 oddities in the German government's coalition agreement

Merkel's first attempt to form a coalition, with the center-right Free Democrats and the Greens, failed. But she succeeded in doing a deal with the Social Democrats after weeks of late-night negotiation and over the opposition of many regional SPD leaders and one-third of the party rank and file.

The 63-year-old Merkel will now begin her fourth term as German chancellor and her third as the leader of a grand coalition.

Conservative explanations, opposition jeers

Merkel's fellow conservatives were quick to blame the closeness of the Bundestag vote on Social Democrats still unhappy with the prospect of another four years of a grand coalition.

"A real slap in the face would have been if we failed to get a majority," designated Transportation Minister Andreas Scheuer of the Bavarian conservative party CSU told German TV.

Designated SPD chairwoman Andrea Nahles called Merkel's election "good news" for Germany and Europe, although SPD deputies didn't applaud when the result of the vote was announced.

Opposition leaders heaped scorn on Merkel's showing in the Bundestag vote.

"The result shows that the chancellor has lost authority," FDP Chairman Christian Lindner told Deutsche Welle. "We saw when the SPD members voted on the coalition agreement that many people wanted renewal and new policies, and obviously they documented that today."

AfD co-chairman Alexander Gauland characterized the vote as "two loser parties circling the wagons to govern the country whatever way they can." Green party co-chairwoman Annalena Baerbock told German TV, "The grand coalition lacks any desire to shape society." And Left Party co-chairwoman Katja Kipping tweeted: "Only 9 votes over the line. Merkel and the new government have stumbled out of the blocks."

Presidential praise amidst AfD protests

Later in the day, Steinmeier officially confirmed the members of Merkel's new cabinet. In a short speech before that ceremony, the German President praised the new government as good for Germany and Europe.

"These are years of truth for democracy," Steinmeier said. "Many people expect us to show that democracy is capable of taking action for future."

But there were also minor disruptions in this day of German democratic procedure. During the vote in the Bundestag, an assistant to an AfD deputy unrolled a banner reading "Merkel must go" in the spectators' balcony and was expelled from the chamber.

And an AfD deputy was himself fined 1000 euros ($1237) for photographing his ballot on which he had voted against Merkel and posting the image on social media together with the message "Not my chancellor." That violated the parliamentary rules governing a secret vote.