German lawmakers have officially elected Chancellor Angela Merkel to continue leading the country for a fourth term after months of grueling coalition talks that left the country in limbo following elections in September. Members of Germany's Bundestag voted 364 in favor, 315 opposed and nine abstentions."I accept the vote," Merkel told parliamentarians. Her fourth term ends more than five months of political wrangling and uncertainty that weakened Merkel's governing coalition. Last week party leaders of the center-left Social Democrats (SPD) announced that party members had endorsed a deal to form a new governing coalition with Merkel's center-right Christian Democrats. "The fact Merkel only received nine votes more than the 355 she needed to be re-elected also shows the level of political opposition she faces in what will be her last and likely toughest term," NPR's Soraya Sarhaddi Nelson says. The grand coalition accounts for 399 votes in the Bundestag. Percentage-wise, Merkel's previous government coalition held 80 percent of seats; that's now just 56 percent, The Local Germany reports."It is a good start for Germany to have a stable government ... after so many months, there is now a big incentive to get down to work with energy," Defense Minister Ursula von der Leyen said, according to Reuters.As The Associated Press notes, Merkel faces the simultaneous challenges of managing a potential trade war with the U.S., finding "common ground with France and others on shaping the European Union's future," all while juggling the competing demands of a "fragile" coalition government.The same coalition has governed since 2013. But the Christian Democrats "only turned to the SPD to prolong the 'grand coalition' ... out of desperation, after talks on a three-way alliance with two smaller parties collapsed last November," as Reuters describes.As part of the deal, the SPD now gains more influence over policy than before. The deal includes handing the SPD control of Germany's finance ministry. The SPD "is likely to relax the strict fiscal discipline that prevailed" under the previous finance minister, who "enforced the austerity imposed on crisis countries like Greece and Portugal in return for eurozone aid," The New York Times says.The far-right and anti-immigrant Alternative for Germany, or AfD, which saw the biggest gains in September's elections, will now be the country's biggest opposition party. "To answer the new right-wing threat, designated interior minister Horst Seehofer has pledged a 'zero tolerance' law" and "faster deportations of failed asylum-seekers," The Local says. Copyright 2018 NPR. To see more, visit http://www.npr.org/.