The U.S. economy added 2.5 million jobs in May and the unemployment rate fell to 13.3%, federal figures showed Friday, surprising economists who expected further job losses caused by the coronavirus pandemic.

The improvements came as states lifted orders that shut down businesses to slow the spread of the virus. Unemployment is still at levels not seen since the Great Depression, but economists and government officials said Friday’s report was a sign that the worst of the pandemic’s impact on the jobs market is over.

The unemployment rate dropped by 1.4 percentage points, from 14.7% in April, which was the highest level since the government began tracking such data in 1948, according to the U.S. Bureau of Labor Statistics. A broader measure of unemployment — which includes part-time workers and those who gave up looking for work — fell from 22.8% to 21.2%.

The number of unemployed people fell by 2.1 million, to 21 million, BLS said. Employment rose sharply in leisure and hospitality, construction, education and health services, and retail trade.

Economists had predicted the unemployment rate to soar near 20%, so the latest data suggests the reopening of the economy was faster and stronger than expected. However, after having lost 22.1 million jobs in March and April, the U.S. is still in a deep hole. The Congressional Budget Office predicted this week that the economy won’t fully recover from the fallout until 2030.

The Labor Department later acknowledged that it made errors in how it classified people as employed, the Associated Press reported, saying the real May rate is worse than the numbers indicate. The department made similar errors in April, and the figures still show the job market is improving.

Before monthly figures were released Friday, some economists saw signs that the economy may have already hit rock bottom, as the number of new unemployment claims continued to fall last week.

Mark Zandi, the chief economist at Moody’s Analytics, said the latest data reaffirmed his view that the recession is over.

“The May employment gain overstates the rebound, and will likely be revised way down, but it still makes the case the economy has turned the corner," he said.

U.S. stock indexes surged on the unexpected job gains. The Dow Jones Industrial Average was up 934 points, or more than 3.5%, in early afternoon trading on Friday.

Unemployment rates dropped for adult men (11.6%), adult women (13.9%), whites (12.4%), Hispanics (17.6%), and teenagers (29.9%), BLS said. But the jobless rates slightly increased for blacks (16.8%) and Asians (15.0%).

Restaurants and bars drove much of the job market improvement, hiring 1.4 million people in May and accounting for about half of the gain in total non-farm employment, BLS said. That followed steep declines in March and April, when 6.1 million jobs were lost in food services and drinking places.

About 464,000 people were hired or rehired in construction, 424,000 in education and health services, and 368,000 in retail, BLS reported.

“The road to recovery has begun,” Joel Naroff, president and founder of Naroff Economic Advisors in Bucks County, wrote Friday. “It was expected that May would be the last month of really ugly employment numbers, but the moves to reopen came faster and stronger than anticipated."

In recent weeks, states have relaxed restrictions put in place to slow the spread of the coronavirus, which has infected at least 1.9 million Americans and killed at least 110,000.

In Pennsylvania, all 67 counties are at some stage of reopening, with Philadelphia and its surrounding counties entering the first, or “yellow,” phase of relaxed restrictions Friday. That allows retailers, day-care centers, and offices to reopen.

New Jersey plans to let restaurants resume outdoor service and nonessential retail at 50% capacity starting June 15.

President Donald Trump, who had hitched his reelection bid to the strength of the economy before the coronavirus crushed it, predicted a “rocket ship” economic rebound Friday and defended his handling of the pandemic.

The monthly jobs report does not include details on state unemployment rates, with those figures to be released later this month. In April, Pennsylvania’s unemployment rate reached 15.1%. The unemployment rate was 15.3% in New Jersey.

It’s too soon to know how widespread protests against police brutality toward black Americans — which disrupted business operations in major U.S. cities — may affect the labor market and economic recovery. The employment data is based on a U.S. Census Bureau survey of about 60,000 households conducted in the middle of May, before the protests started.

Almost 1.9 million Americans applied for unemployment benefits last week, and the total number of people who are receiving jobless aid ticked up to 21.5 million, the Labor Department said Thursday.

The number of new claims for financial help continued to fall across the nation, including in Pennsylvania and New Jersey. There were 50,462 new claims in Pennsylvania and 25,632 filed in New Jersey during the week ending May 30. Those were down from peaks in early April but still way above pre-pandemic levels.