By Tom Fairless

FRANKFURT -- Stringent lockdowns to prevent the spread of Covid-19 weighed heavily on Europe's economy in the second quarter, causing a record contraction more severe than experienced by the U.S., but analysts said the continent's success so far in avoiding a resurgence of the disease coupled with aggressive government stimulus should help support a nascent recovery.

The eurozone's gross domestic product fell 40.3% on an annual basis, far exceeding the 32.9% contraction in the U.S. economy over the same period, according to data published Friday. That was equivalent to a 12.1% decline from the previous quarter, pushing the bloc as a whole into recession, by far the sharpest drop since comparable records began in 1995, the European Union's statistics agency said in a statement.

Despite Europe's steeper decline, recent data suggest the region "is having a much bigger snapback and there are some indicators that it may be getting ahead" of the U.S., said Holger Schmieding, chief economist at Berenberg Bank.

While the U.S. grapples with tens of thousands of new infections a day, Europe has largely brought the virus under control even as it has eased restrictions and reopened internal borders, notwithstanding a recent jump in cases in countries such as France and Spain.

Confidence appears to be surging among European consumers and businesses, supported by the billions of euros that governments have lavished on job-protection programs, aggressive stimulus from the European Central Bank and a EUR1.8 trillion ($2.1 trillion). European Union spending package aimed at supporting the bloc's weaker countries.

Governments across Europe have introduced or expanded job-furlough programs in recent months, effectively paying employers to keep workers on the books and helping to support confidence and spending.

The eurozone's unemployment rate edged up to 7.8% in June from a low of 7.2% earlier this year. In the U.S., 11.1% of workers were unemployed in June, up sharply from 3.5% earlier this year. And while many European job-protection schemes will continue into next year, an additional $600 weekly benefit for Americans who lost their jobs because of the pandemic is set to expire Friday.

The euro has been on a tear against the dollar in recent weeks, rising close to a two-year high. That reflects both investors' rising confidence in Europe and the U.S.'s uneven progress in halting fresh infections.

"The business in Europe has been and currently is stronger than in the U.S.," Bjørn Gulden, chief executive of German sporting-goods maker Puma SE, told reporters Wednesday on a call discussing the company's second-quarter results. In the U.S., he said, demand varied widely from state to state.

Annualized growth figures extrapolate what would happen over a full year if the economy grew or contracted at the same rate as in the quarter being measured. Usually, economic growth rates don't vary too much from one three-month period to another. But this year, economists expect big differences, with large falls in the first half to be followed by strong rebounds in the second.

Economists at Commerzbank still expect the U.S. to remain ahead, with the economy contracting 4.5% for 2020 as a whole compared with 7% for the eurozone's. That reflects the lighter U.S. lockdown and aggressive government stimulus. The U.S. economy will likely grow 4% in 2021, compared with 5% for the eurozone, the analysts predict.

Lakshmi Mittal, CEO of ArcelorMittal, the world's largest steelmaker, said that his company's order books indicate that the U.S. is pulling ahead.

"The U.S. is recovering faster than Europe, we are seeing that from our customer bases," Mr. Mittal said. That is primarily down to U.S. auto makers, he said. The recovery "will depend on customers, how ready they are," he added.

But while a surge in new cases in the U.S. is holding back reopening plans, in the eurozone the economic recovery continued to progress in July as the virus remained largely contained, said Daniel Vernazza, an economist at UniCredit in London. Recent mobility data suggest the U.S. is now underperforming all major eurozone countries, he said.

Europe still faces major challenges. Like the U.S., it could take years before its economy returns to its 2019 size. Moreover, the region is highly dependent on exports and tourism, neither of which will recover fully until the virus is under control around the world. In Southern Europe, governments need to service massive debts that have been inflated by the mammoth costs of containing the pandemic. Borrowing costs have so far been kept in check by aggressive government-bond purchases by the ECB, but central-bank officials have stressed that the support is temporary.

Pockets of infection are resurfacing, including in northeastern Spain, dealing a blow to the nation's large tourism sector. Tourists are staying away this year, with occupancy rates of holiday accommodation below 30% in Italy, Greece and Spain.

That is widening the economic divide between Europe's industry-rich north and its poorer south, whose economies had to contend with a worse health crisis, a deeper economic collapse and high debts that deter aggressive stimulus. Spain's economy contracted 18.5% in the second quarter compared with the previous three months, and Italy's 12.4%. Germany's economy performed better, shrinking 10.1% compared with the first quarter, thanks to a relatively light lockdown and aggressive government spending.

Still, the EU's new spending package should help to support confidence and push up economic growth in the weaker South. In Greece, growth will be about 2 percentage points higher than expected each year for the next six as a result of the EU deal, Greek central bank governor Yannis Stournaras said this week.

Industrial production and retail sales have rebounded strongly in Europe since their April trough, though activity hasn't yet returned to precrisis levels.

McDonald's Corp. CEO Chris Kempczinski said on a call with investors Tuesday that he sees strong opportunities in Europe, "where I think there may be some independent restaurant units that are having some bigger challenges."

"In many markets around the world, most notably in the U.S., the public-health situation appears to be worsening," Mr. Kempczinski said.

Fiat Chrysler Automobiles NV has been ramping up production after completely shutting down its factories in mid-March. About three-quarters of employees in production who were working at the end of February are back in the factories. Several of the company's large Italian assembly plants, including one that produces the Jeep Renegade and Compass as well as the Fiat 500X crossover, are working at full capacity.

Volkswagen AG sales chief Christian Dahlheim said Thursday there was a "clear positive trend" in Western Europe in recent months as restrictions loosened and car dealerships reopened. In Germany, order entries for June were even above the numbers of last year, he said.

The recovery is less pronounced in the U.S. than in Europe, partly because demand there didn't collapse quite as dramatically as in Europe during the shutdowns, Mr. Dahlheim said.

Ruth Bender

in Berlin,

Eric Sylvers

in Milan and Alistair MacDonald in London contributed to this article.

Write to Tom Fairless at tom.fairless@wsj.com