BERLIN — Earlier this year, German Chancellor Angela Merkel had been written off by many as a lame duck. Her coalition and party were beset by infighting, and speculation was rife that she would buckle to pressure to step aside before the end of her final term in 2021.

But a coolheaded and effective response to the coronavirus crisis has pushed Merkel’s approval ratings as high as 86 percent within Germany. She is in a position of strength and confidence this week as she steers Europe’s effort to address what is predicted to be its deepest economic recession on record.

Merkel, who turns 66 on Friday during the European Union’s first in-person summit since the start of the pandemic, is “in the midst of her power,” said veteran German political scientist Hajo Funke.

Because it is Germany’s turn to fill the rotating E.U. presidency, the chancellor is at the helm in both Brussels and Berlin at a crucial time for the 27-member bloc.

“She’s now the E.U. chancellor, so to speak,” Funke said. “She wants to have a success story now, an efficient success story; she wants to do things, starting with revitalizing the European Union.”

The challenges remain huge, given the potential for a resurgence of the virus and the still-emerging economic fallout, as well as unresolved Brexit negotiations and Europe’s awkward position in the middle of the intensifying feud between the United States and China.

But it is also an opportunity for Merkel to burnish her legacy.

At this week’s summit, E.U. leaders will be negotiating over a proposed $855 billion coronavirus recovery plan, alongside a $1.2 trillion budget for the next seven years.

European Council President Charles Michel is officially tasked with finding a compromise among member states, but any deal will depend on Merkel’s long-honed skills as a negotiator, as well as Germany’s economic might.

“Expectations are high,” said Thomas Heilmann, a parliamentarian with Merkel’s Christian Democrats, speaking of efforts to broker a financial agreement. “And if Germany fails to get things done, people will question, ‘If Merkel can’t do it, who else will do it?’ ”

Although she has been known as the face of European austerity, and although Germany has long resisted tying its financial fortunes to weaker economies in the bloc, Merkel has joined French President Emmanuel Macron in promoting a plan that would collectivize E.U. debt and help the countries hit hardest by the pandemic through a combination of grants and loans.

The plan faces opposition from a handful of countries — the “frugal four” of the Netherlands, Denmark, Sweden and Austria — who prefer that assistance be offered as loans with strings attached.

Leaders are also fighting over whether aid should be conditional on adherence to democratic principles. Poland and Hungary, earmarked to be among the biggest recipients, have been criticized for rolling back protections for independent courts, a free press and the rule of law.

All 27 member states must agree.

Merkel’s reputation as the austerity chancellor has particularly bothered her, according to Stefan Kornelius, who wrote her authorized biography. In the wake of the European debt crisis a decade ago, the German leader was vilified by many in Southern Europe for forcing them into austerity.

Still, Kornelius said Merkel wouldn’t have made the “historic” U-turn on debt if the situation for the E.U. weren’t grave.

While many European leaders received an initial bump in approval during the pandemic, Merkel’s has continued to grow, according to a recent poll by German channel ZDF.

“The characteristics that distinguish her have come to the fore in the pandemic, which is measured, facts-based, evidence-based, consensus-oriented leadership,” said Constanze Stelzenmüller, a senior fellow at the Brookings Institution.

Party colleagues say Merkel, who has a doctorate in quantum chemistry, was quick to recognize the seriousness of the impending crisis early this year.

Dorothee Bär, minister of state for digitalization, recalls how Merkel asked Health Minister Jens Spahn to brief other cabinet ministers in early January on what was happening in China and what it might entail for Germany.

By the end of February, she had completely shifted into “crisis mode,” Heilmann said.

In mid-March, she spoke to the country in a rare televised address, normally reserved for her annual New Year’s remarks.

She told Germans: “Take it seriously.”

Because she is not one known for spin or hyperbole, the population listened.

“She changed her communication,” said Robin Alexander, a journalist with Die Welt newspaper who wrote a book on the chancellor’s handling of the refugee crisis. “She is reaching out to the people, and they like it.”

Overseeing Germany’s coronavirus response has also involved corralling the leaders of the country’s 16 states, where the power to impose shutdowns and loosen restrictions lies.

“Germany wouldn't have weathered it so well had she not worked very hard at buying the scenery to get all the minister presidents in line,” said Stelzenmüller.

The country’s coalition government, which had looked to be on the brink of collapse, has united, a fact Stelzenmüller also credits to Merkel’s party’s main coalition partner, the Social Democrats, playing a constructive and important role.

Karl Lauterbach, a parliamentarian with the Social Democrats, said other ministers have not received enough credit for the crisis response and that a “good amount of luck was involved” in Germany avoiding a more brutal outbreak.

“We were hit by the pandemic at a moment when we were already seeing the horrible images from northern Italy,” he said. “There was a very close collaboration between scientists and politicians, which I have never seen before in my entire career.”

But among Germany’s political parties, it’s only Merkel’s Christian Democrats who have seen a boost during the pandemic. After reeling from a number of stinging local election performances last year — including a humiliating result in Hamburg — the party has climbed 11 points in the polls during the pandemic.

Still, Merkel’s legacy remains unsecured, as she has no obvious successor. Her favored candidate, Annegret Kramp-Karrenbauer, wilted under the national spotlight and withdrew herself from contention earlier this year.

This week, there was fevered speculation that Merkel would give the nod to a second choice during a trip to Bavaria, where she was received in grand style by Markus Söder, the state’s premier. The pair took a horse-and-carriage ride and a boat trip on the lake, before a photo op on the steps of an opulent Bavarian palace.

But there was no signal from Merkel of an endorsement.

Analysts suggested that she may be under pressure to support someone from her own party, rather than the Bavarian sister party Söder belongs to. Or perhaps Merkel intended the trip to project unity and power ahead of the summit in Brussels.

Pre-summit negotiations have been thorny enough that diplomats made no promises that a deal will be reached this weekend. Some said another summit this month is inevitable.

But even with rocky talks ahead, some analysts say that there is little that can touch Merkel now, and gone are the doubts that she may not make it to the end of her term. “It's probably a first that after 16 years or 15 years, a chancellor has a chance to ride into a glorious sunset and not into a thunderstorm,” Kornelius said.

Fiona Weber-Steinhaus and Luisa Beck in Berlin and Michael Birnbaum in Brussels contributed to this report.