By David Harrison and Paul Hannon

The U.S. economy picked up momentum this month as companies shook off the effects of the pandemic-induced downturn, though recoveries in other parts of the world slowed, according to new surveys of purchasing managers.

The data released Friday suggest U.S. firms are seeing demand return as they reopen from the lockdowns imposed in the spring and early summer. They also indicate the economy has so far managed to weather July's sharp rise in new coronavirus infections and business closures that threatened to knock the recovery off course.

Data firm IHS Markit said its composite purchasing-managers index, a measure of manufacturing and services activity, rose to 54.7 from 50.3 in July, an 18-month high, with both sectors seeing a big increase. A reading above 50 is a sign of expansion while a reading below 50 is a sign of contraction.

The index of manufacturing output was up to 53.6 from 50.9 in July. The services activity index rose to 54.8 from 50.

"It's solid," said Michael Pearce, senior U.S. economist at Capital Economics. "We've had a few reasons to worry that the recovery might have lost momentum or gone into a bit of a reverse but they don't seem to have materialized. The economy seems to be powering ahead."

In a separate report Friday, the National Association of Realtors said sales of previously-owned homes surged 24.7% in July from June, propelled by low interest rates and people's desire for more space.

Economists warned that the unusual economic environment -- a sharp and deep contraction in the spring caused by a global pandemic -- makes it harder to interpret recent data. For instance, Mr. Pearce said, since the PMI numbers only measure month-to-month change, they don't show how much ground the U.S. still needs to make up.

U.S. output fell at an annualized rate of 32.9% in the second quarter, the worst contraction on record, the Commerce Department said. Economists surveyed by The Wall Street Journal earlier this month expected an 18.3% annualized pace of increase in the third quarter.

Other indicators suggest the U.S. economy remains vulnerable. New applications for jobless benefits rose last week, the Labor Department reported Thursday. Payroll gains slowed in July from June. More pain could be on the way as several companies, including Boeing Co., have announced job cuts.

The Federal Reserve said last week that industrial production was still 8.2% below its level a year ago. Restaurant reservations are about 50% of where they were a year ago, according to OpenTable, an improvement from April and May, when they had almost completely frozen up.

A rise in demand drove the August expansion, IHS Markit said, thanks to returning customers, new marketing campaigns and the easing of lockdowns overseas, which helped boost exports. Survey respondents said they remained optimistic about the next 12 months although they expressed concerns about the pandemic.

Arne Sorenson, chief executive of Marriott International Inc., said business at the hotel chain had been recovering, driven largely by cooped-up leisure travelers eager to get out of the house.

"I am no more optimistic about the virus than I was a month ago," he told analysts last week. "I am, however, more optimistic about the recovery of travel and the recovery of our business."

William Meaney, CEO of Iron Mountain Inc., a data-management company, said its second-quarter revenue decline wasn't as bad as expected but the outlook remained uncertain.

"We continue to see some risk around the second half depending upon what happens with the progression of the virus and possible additional restrictions," he told analysts in an Aug. 6 conference call.

In Europe, IHS Markit's composite PMI for the eurozone fell to 51.6 in August from 54.9 in July, indicating its expansion slowed. This comes as infections are again surging in Europe, hitting the services sector particularly hard, including the tourism industry at what is usually its busiest time of the year.

Those affected have been much younger on average than during the first wave of the pandemic, and hospitalizations have been much lower. According to economists, that makes it less likely that governments will revert to widespread lockdowns, which would likely send the eurozone economy back into contraction.

In contrast with the services sector, some of Europe's factories reported strong growth in August, with German businesses citing a pickup in orders from China. However, their French counterparts saw growth slow sharply.

The eurozone's economy contracted more sharply than the U.S. in the second quarter, reflecting that the European lockdowns were more restrictive and longer-lasting. Eurozone policy makers had hoped that by getting a firmer grip on the virus, the currency area's economy would see a stronger rebound during the remainder of the year and into 2021. If the surveys are backed up by other data in recording a slower-than-expected expansion, the European Central Bank is more likely to provide additional stimulus in the coming months.

Japan's economy contracted less sharply than those of the U.S. and the eurozone in the second quarter, but that was partly because output had already started to fall in the final three months of 2019.

The IHS Markit survey indicated that Japan's economy contracted again this month, with the composite PMI unchanged at 44.9 in August.

Write to David Harrison at david.harrison@wsj.com and Paul Hannon at paul.hannon@wsj.com