This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

Nancy Pelosi was narrowly reelected Sunday as speaker, giving her the reins of Democrats’ slender House majority as President-elect Joe Biden sets a challenging course of producing legislation to tackle the pandemic, revive the economy and address other party priorities.

The California Democrat, who has led her party in the House since 2003 and is the only woman to be speaker, had been widely expected to retain her post. Pelosi received 216 votes to 209 for Rep. Kevin McCarthy, R-Calif., who again will be the chamber’s minority leader.

To gain her victory, Pelosi had to overcome some Democratic grumbling about her longevity, a slim 222-211 edge over Republicans after November’s elections, and a handful of absences because of the coronavirus. There were two vacancies in the 435-member House, and whatever happens Democrats will have the smallest House majority in two decades.

The new Congress convened Sunday, just two days after lawmakers ended their contentious previous session and with COVID-19 guidelines requiring testing and face coverings for House members. There was widespread mask-wearing and far fewer lawmakers and guests in the chamber than usual, an unimaginable tableau when the last Congress commenced two years ago, before the pandemic struck.

Rep. Hakeem Jeffries, D-N.Y., formally nominated Pelosi for the job, calling her “a notorious negotiator and a legendary legislator for such a time as this.”

Jeffries, a member of House leadership who’s expected to contend for the speakership whenever Pelosi steps aside, said that as Pelosi prepares to work with Democratic President-elect Joe Biden, “Brighter days are ahead in the United States of America. This is the day of great renewal in the House of Representatives.”

To be reelected, Pelosi needed a majority of votes cast for specific candidates and could afford to lose only a handful of Democratic votes. House rules give her a bit of wiggle room because lawmakers who are absent or who vote “present” are not counted in the total number of those voting.

Sunday’s vote was expected to last perhaps three hours as lawmakers voted in groups of around 72 each to minimize exposure to the virus.

With every vote at a premium, workers had constructed an enclosure in a balcony overlooking the House chamber so lawmakers exposed to or testing positive for the coronavirus could more safely vote. Rep. Tim Ryan, D-Ohio, voted from there.

Two Democrats who tested positive for the virus last month and say they have recovered voted for Pelosi from the House floor: Wisconsin Rep. Gwen Moore and Washington state Rep. Rick Larsen.

In a positive sign for Pelosi, newly elected progressive Rep. Jamaal Bowman, D-N.Y., voted for her. “Our country needs stability right now, and it’s really important for the Democratic Party to come together,” Bowman told a reporter.

Pelosi won plaudits from many Democrats for two years of leading their opposition to President Donald Trump, largely keeping her party’s moderates and progressives united on their joint goal of defeating him and raising mountains of campaign funds. No Democrat has stepped forward to challenge her, underscoring the perception that she would be all but impossible to topple.

But Pelosi is 80 years old, and ambitious younger members continue chafing at the longtime hold she and other older top leaders have had on their jobs. Democrats were also angry and divided after an Election Day that many expected would to mean added House seats for the party but instead saw a dozen incumbents lose, without defeating a single GOP representative.

Pelosi recently suggested anew that these would be her final two years as speaker, referencing a statement she made two years ago in which she said she would step aside after this period.

The speaker’s election was coming 17 days before Biden is inaugurated. Yet rather than a fresh start for him and Pelosi, there were issues and undercurrents that will be carrying over from Trump’s tempestuous administration.

Though Congress enacted — and Trump finally signed — a $900 billion COVID-19 relief package late last month, Biden and many Democrats say they consider that measure a down payment. They say more aid is needed to bolster efforts to vaccinate the public, curb the virus and restore jobs and businesses lost to the pandemic.

Many Democrats, with the unlikely support of Trump, wanted to boost that bill’s $600 per person direct payments to $2,000 but were blocked by Republicans. Democrats want additional money to help state and local governments struggling to maintain services and avoid layoffs.

Biden’s priorities also include efforts on health care and the environment.

Guiding such legislation through the House will be a challenge for Pelosi because her party’s narrow majority means just a handful of defectors could be fatal.

In addition, cooperation with Republicans could be made more difficult as many in the GOP are continuing to demonstrate fealty to the divisive Trump, backing his unfounded claims that his reelection loss was tainted by fraud. Congress will meet Wednesday to officially affirm Biden’s clear Electoral College victory over Trump. Many House and Senate Republicans say they will contest the validity of some of those votes, but their efforts that are certain to fail.

There was no widespread fraud in the election, which a range of election officials across the country, as well as Trump’s former attorney general, William Barr, have confirmed. Republican governors in Arizona and Georgia, key battleground states crucial to Biden’s victory, have also vouched for the integrity of the elections in their states. Nearly all the legal challenges from Trump and his allies have been dismissed by judges, including two tossed by the Supreme Court, which includes three Trump-nominated justices.

Meanwhile, it’s not clear which party will control the Senate, which Republicans will hold unless Democrats win both Senate runoff elections in Georgia on Tuesday.

In the House, one race in New York is still being decided and there is a vacancy in Louisiana after GOP Rep.-elect Luke Letlow, 41, died after contracting COVID-19.