The federal unemployment rate dropped in May for the first time since the coronavirus sent the economy into a tailspin, the strongest sign yet that the economic damage is bottoming out — although 21 million people remain out of work.

The economy gained 2.5 million jobs in May, the first time it has added jobs since February, as hundreds of thousands of workers flooded back to jobs in restaurants, health care and construction with the reopening of several states in mid-May.

The May unemployment rate dropped to 13.3 percent from 14.7 percent. The positive news was complicated by the fact that the Bureau of Labor Statistics said it had misclassified data in May, as it had in April and March. Without the error, the unemployment rate would be higher: 16.3 percent for May, down from 19.7 percent for April, the agency said.

Many economists had been predicting the unemployment rate might hit 20 percent, but they seemed to underestimate the effect of the economy’s reopening, as well as programs such as the Paycheck Protection Program, which steered $660 billion in loans to medium and small businesses with incentives for rehiring employees.

“It’s a very good jobs report all around, but the caution is there’s so much more to go from here,” said Glenn Hubbard, the former chief economist under President George W. Bush.

President Trump cheered the jobs market news Friday and was buoyed by a day of rallies on Wall Street. The Dow Jones industrial average and the Standard & Poor’s 500-stock index both hit high points not seen since the days before the pandemic took hold in early March, signaling confidence in a V-shaped economic recovery.

“This is a very big day for our country,” Trump said at a White House news conference. “It’s an affirmation of all the work we’ve been doing.”

Still, the labor market remains in a state of more disruption than at any time since the Depression era. Even a 13.3 percent unemployment rate outpaces the jobless rates following the financial crisis of 2008 and 2009. The last time ongoing double-digit jobless rates were seen was in the aftermath of the Great Depression.

Roughly 30 million workers are still collecting unemployment benefits, including 1.9 million people whose initial claims were processed last week, according to government claims data. And many more could lose their jobs as the cascading financial pressure from the coronavirus sinks deeper into the economy.

Nearly 50 percent of commercial rents are not being paid, large companies such as Diamond Offshore Drilling and J.C. Penney have filed for bankruptcy protection, and expanded unemployment benefits for millions could dry up in August, which could lead to a wave of deferrals on credit cards, car loans and mortgages.

The nonpartisan Congressional Budget Office expects the economic consequences of the novel coronavirus to exceed $8 trillion and suggests the economy will not fully recover until 2030. The CBO also forecasts unemployment levels continuing above 10 percent into 2021, meaning the nation could still have joblessness that is worse than the Great Recession for months.

And many people have lost jobs permanently as companies learn to operate with fewer people, said Jason Furman, a former chief economist for President Barack Obama. Much of the early job growth comes from people coming off temporarily layoffs.

“You’ll see some fast gains early on, but then it’s going to get a lot harder to recover,” Furman said.

The unexpectedly optimistic jobs numbers could embolden those on Capitol Hill who have been opposed to an additional round of stimulus spending. Congressional Republicans and the White House have expressed skepticism about the need to approve or extend emergency economic aid, saying policymakers should wait to evaluate the impact of easing public health restrictions on the economy.

Yet many economists, labor advocates and Democrats said that the numbers were a sign that the government’s stimulus has been working. In a note sent Friday, economist Joseph Brusuelas of RSM said that the labor-market numbers indicated that the government’s Paycheck Protection Program, meant to incentivize businesses to keep employees on, had worked.

The labor-market news comes as the reopening of the country begins to get into full swing.

Restaurants have begun to fill in states such as Texas, Tennessee and Colorado, a change reflected in a significant upswing in food and beverage jobs in May. Those gains, of about 1.4 million workers, accounted for about half of the month’s total job gains after steep declines the previous two months.

Employment in the hardest-hit sector of the economy, leisure and hospitality, has started to climb back as well, with 1.2 million jobs added as hotels begin to see occupancy rates tick up. Construction employment increased by 464,000 as building permits and spending climb back up in many parts of the country. And the health-care industry, which was hammered by the cancellation of elective procedures, also recovered 312,000 jobs between April and May.

And the National Basketball Association, whose closure helped mark the beginning of shutdowns across the United States, announced a limited return of play for later this summer.

Maria Lowery, 47, is one of the 2.5 million people who headed back to work in May. She was slightly apprehensive about her return to work on May 4, after a six-week furlough from the shoe store she helps manage in McDonough, Ga., but has since gotten used to wearing a mask at work and speaking to customers behind a plexiglass shield.

“I don’t like being at home,” she said. Business, she said, has been strong.

The unusual nature of this public health pandemic is complicating the economic recovery. Without a cure or vaccine, the virus may return to deliver more suffering and economic destruction, and public health officials have warned about another wave of infections later this year.

While the rate of new coronavirus infections has slowed, so far 108,000 people in the United States have died in the pandemic, with new cases spiking in Texas, Oregon and Arizona in recent days.

And while businesses across many states have been allowed to reopen, they have yet to see anything close to the levels of sales they were accustomed to before the pandemic, in part because some people are still wary of infection.

Wendy Reid, 68, the owner of a yarn and crafts shop in Burnsville, N.C., said that her business has been down 90 percent. Reid said she has applied for just about every form of relief in the books — that Paycheck Protection Program, the Economic Injury Disaster Loan Emergency Advance, unemployment insurance and county assistance — but has been unable to qualify for any of them because of a stew of bureaucratic issues with her business’s classification.

“I feel like I’m working twice as hard at my business to generate 10 percent of the sales,” she said.

Economists agree that getting back to normal will take longer and be more challenging than in past recessions. For example, a substantial portion of the job growth in May — about two-fifths — was driven by part-time jobs, an indication of how fragile and uneven the recovery could be.

Government workers are still being laid off in large numbers — more than 1.5 million lost their jobs in April and May, according to the Labor Department. In May, that loss was driven by the decline in local government jobs, primarily teachers. And there are signs that white-collar workers have begun to feel the affects of the sluggish economy as well.

Black Americans saw their unemployment rate increase, as more black people entered the workforce and were counted among those unemployed looking for work. Whereas the employment rate for white people went down from 14.2 to 12.4 percent, the employment rate for blacks ticked up, from 16.7 to 16.8 percent.

“One thing we’ve talked about this week with police protests is that we’ve left African Americans behind in lot of things. The jobs day numbers reflect that,” said Olugbenga Ajilore, a senior economist at the left-leaning Center for American Progress. “Whenever we have a recovery — blacks are always left behind.”

The federal government poured an additional $1.25 trillion into the economy in the third quarter of 2020, with much of that funding taking effect between the April and May jobs reports. Federal aid is set to peter out soon, with Americans spending their $1,200 stimulus checks and a $600-per-week increase in unemployment benefits to expire at the end of July.

And the United States will need to keep gaining jobs back at a similar rate if it wants to mount a V-shaped recovery, which is why Democrats and some economists are saying additional government funding is still needed to avert a downturn.

The jobs report also included an unusual note about an “error” in the data collection, saying the unemployment rate likely should be 16.3 percent, higher than the widely reported 13.3 percent rate. The Bureau of Labor Statistics, the agency that puts out the monthly jobs reports, said it was working to fix the problem, which began in March.

There was a big jump in people claiming they were temporarily “absent” from work for “other reasons,” when they should have been classified as unemployed. The agency said the March unemployment rate probably should have been 5.4 percent, instead of the official 4.4 percent rate. In April, the BLS said, the real unemployment rate was probably about 19.7 percent, not 14.7 percent.

Andrew Van Dam, Jeff Stein and Thomas Heath contributed to this report.

CORRECTION: A version of this story posted minutes after the release of new Labor Department jobs data said that 2.5 million jobs were lost in May, rather than gained. The error has been corrected.