The U.S. labor market cooled but remained robust in the late spring as job openings fell, fewer people quit and layoffs rose, Labor Department figures on May hiring demand and worker turnover showed.

The Labor Department on Wednesday said there were a seasonally adjusted 11.3 million job openings in May, a decline from an upwardly revised 11.7 million the prior month. That marked the second straight month of a decrease from a record high number of openings reached in March.

The number of times workers quit their jobs fell slightly to 4.3 million from the prior month, while the number of layoffs and discharges rose to 1.4 million in May from 1.2 million the prior month.

The figures, released Wednesday, add to evidence that the labor market—although still unusually tight—has started to loosen amid signs of slowing economic growth.

Numerous economic readings point to U.S. growth losing momentum under the weight of rising prices and rising interest rates from the Federal Reserve’s campaign to slow growth and cool inflation that is running at its fastest pace in four decades. Consumer spending and industrial output slowed in May, along with a decline in home construction. Recent surveys of purchasing managers on June manufacturing and services activity also pointed to a slowing U.S. economy.

Fed officials, in minutes released on Wednesday, said they concluded last month that they needed to pick up the pace of interest-rate increases because the inflation outlook had deteriorated. As a result, rates would need to rise to levels designed to deliberately slow economic growth.

Despite the May easing, the labor market remains strong. Employers added 390,000 jobs in May, a robust gain but below the average pace of monthly job growth last year, and the unemployment rate held at a low 3.6%. Companies such as Tesla Inc. and Robinhood Markets Inc. have recently announced layoffs, but the nationwide total in May remained well below the 2019 average ahead of the Covid-19 pandemic.

The Labor Department will release its June employment numbers on Friday; economists surveyed by The Wall Street Journal think employers created 250,000 jobs last month and the unemployment rate held at 3.6%.

“These unusually historically tight labor market conditions could actually persist for quite a long time,” said Julia Pollak, chief economist at jobs site ZipRecruiter.

Separate private-sector estimates showed that demand for workers held up through mid-June, with ZipRecruiter estimating slightly more than 11.3 million openings. Similarly, Bayard Advertising, a job-advertisement firm, thinks there were 10.9 million openings through mid-June based on job postings and active advertisements.

Job openings reached a record 11.9 million in March, the highest in records dating back to 2000, after they rose throughout 2021, according to the Labor Department. Meanwhile, the number of times workers quit their jobs also soared in 2021, reaching a record 4.5 million in November.

Ms. Pollak said the industries that have been pulling back on hiring, such as technology and real estate, have been doing so mostly because of rising interest rates and stock-market turbulence. The Fed last month raised its benchmark interest rate by 0.75 percentage point.

Companies such as Netflix Inc., Redfin Corp. and Compass Inc. have been shedding workers amid rising costs, but layoffs in the technology industry remain limited.

“There have been some very high-profile layoffs, but that doesn’t necessarily mean that there are widespread layoffs,” said Daniel Zhao, senior economist at jobs site Glassdoor.

Professional and business services openings saw the biggest decline in May with postings dropping by 325,000, the Labor Department said. Manufacturing sectors also posted fewer openings. Postings for leisure and hospitality positions increased.

With fears of an economic downturn, some job seekers are expressing early signs of pessimism about their prospects.

A recent ZipRecruiter survey of job seekers on their ability to land their preferred jobs showed that job seekers still feel confident overall. But their near-term expectations for future labor-market conditions declined significantly in June.

“You’re now starting to see this uncertainty and lack of confidence in other markets seep into the labor market, with job seekers getting a little nervous,” Ms. Pollak said.

Mitch Patel, president and chief executive of Vision Hospitality Group Inc., a hotel-management company that operates 41 hotels across eight states, said his company still needs workers, mostly for housekeeping jobs.

He said hotel managers sometimes clean the rooms themselves because of a shortage of housekeeping staff. To lure new workers, his company raised wages and added sign-on bonuses. He also plans to pay hourly workers daily.

“We just haven’t seen any evidence of a slowdown for us yet,” Mr. Patel said. “We are concerned with that going forward, but we’re having a record summer right now and we will see what everything looks like in the fall and beyond.”

Mr. Patel said demand has been robust, and he expects that to be the case throughout the summer as Americans show an appetite for summer travel. He said he would monitor bookings data and other metrics before making decisions on hiring or benefits changes.

SHARE YOUR THOUGHTS

What is your business doing to attract and retain workers? Join the conversation below.

Ryan Lang, chief executive of Middle West Spirits, a distillery in Columbus, Ohio, has about a dozen openings at his company, which has 72 employees. The company has openings in operations, finance, human resources, sales and marketing, he said.

Middle West Spirits is getting résumés, and many of the applicants appear to be looking for a change from their current careers.

“They’re requesting way more flexibility than we would normally have as a manufacturing company,” Mr. Lang said.

Write to Bryan Mena at bryan.mena@wsj.com and Rina Torchinsky at rina.torchinsky@wsj.com