The U.S. labor market ended 2023 with a bang, gaining more jobs than experts had expected and buoying hopes that the economy can settle into a solid, sustainable level of growth rather than fall into a recession.

Employers added 216,000 jobs in December on a seasonally adjusted basis, the Labor Department reported on Friday. The unemployment rate was unchanged at 3.7 percent.

Although hiring has slowed in recent months, layoffs remain near record lows. The durability of both hiring and wage gains is all the more remarkable in light of the Federal Reserve’s aggressive series of interest rate increases in the past couple of years. But a range of analysts warns that the coast is not yet clear and says the effects of those higher rates will take time to filter through business activity.

“The real test for the labor market begins now, and so far it is passing the test,” said Daniel Altman, the chief economist at Instawork, a digital platform that connects employers with job seekers.

Financial commentary in the past year has been dominated by dueling narratives about the economy. Most economists warned that the Fed’s driving up borrowing costs at a historically rapid pace would send the economy into a downturn. Heading into 2023, over 90 percent of chief executives surveyed by the Conference Board said they were expecting a recession. And many leading analysts thought that price increases could soften only if workers experienced significant job losses.

But the resilience of the overall economy and consumer spending has so far defied that outlook: In June 2022, inflation was roughly 9 percent. Inflation has since tumbled to 3 percent while the unemployment rate has been largely unmoved.

Altogether, the U.S. economy added roughly 2.7 million jobs over the past year. That’s a smaller gain than in 2021 or 2022. Yet the 2023 increase was larger than those in the late 2010s and represented the fifth strongest year for job growth since 2000.

Still, the report included hints that the landing may yet be bumpy.

Services like health care, social assistance work, and state and local governments led the way in December job gains, but previously hot sectors such as transportation and warehousing either lost jobs or edged upward only modestly.

The overall labor force — the ranks of those currently working or seeking work — shrank by almost 700,000 workers, according to the December data. That was unwelcome news after steady labor force growth during much of 2023.

In addition, figures for October and November were revised down by 71,000. That left average monthly job increase in the last quarter of 2023 at about 165,000 — down from about 221,000 in the third quarter and 201,000 in the second quarter.

Omair Sharif, the founder of the data analytics firm Inflation Insights, said in a note to subscribers that the December number represented “a healthy gain,” but added that “hiring has clearly cooled.”

Heading into an election year, the employment picture also has a political dimension.

President Biden, whose handling of the economy has drawn low ratings in voter surveys, heralded the December numbers. “Strong job creation continued even as inflation fell,” he said in a statement, while noting that prices remain a concern for many in the country.

The closely watched University of Michigan Consumer Sentiment Index was lower in December than it has been 83 percent of the time since 1978, a period that has included shocks and slumps that, on paper, look worse than the present. The index climbed for much of last year, however, and several factors may have contributed to sunnier perceptions.

After nearly two years during which inflation was outstripping wage gains, that balance has shifted in recent months. Average hourly earnings for workers rose 0.4 percent in December from the previous month and were up 4.1 percent from December 2022.

The housing market, frozen by higher interest rates, is a source of frustration for aspirational first-time home buyers. But for those who own their homes — roughly two-thirds of American households — the average rate on all outstanding mortgage debt is a mere 3.7 percent, shielding them from higher shelter costs.

Though many families have struggled since 2021, falling back toward poverty as the network of federal aid associated with the pandemic response faded, the share of household disposable income going to debt payments is below its prepandemic level, a sign of solid overall consumer health.

Annie Wharton, a 56-year-old art consultant in Los Angeles, is a beneficiary of the financial stability that many middle-class and more affluent Americans have been able to manage despite the vertigo of the 2020s.

Art is a business that “has always had challenges,” Ms. Wharton said. “But I am happy to say this has been a good year.”

Her office got a loan from the Commerce Department under the Paycheck Protection Program, a key component of the government’s pandemic relief effort, which allowed her to keep her small staff fully employed throughout.

Things have slowed “with an uncertain economic outlook,” she added, saying “people seem more cautious than normal” and “everyone is thinking twice before buying.” But she remains optimistic.

Once again, the biggest uncertainties may come from abroad.

In 2022, just as global supply chain disruptions were easing, the Russian invasion of Ukraine caused oil and a wide range of food and energy commodities to soar, sometimes doubling or more in price, driving further inflation.

Last year largely provided a lull in new disruptions. But conflagrations in the Middle East have broadened since fall, threatening key international trade routes. Maersk, the goliath company in international shipping, has announced that for the foreseeable future it will keep container ships away from the Red Sea, where drone and missile attacks against merchant ships have picked up in recent weeks.

As a result, the cost to ship goods from Asia to northern Europe has surged by roughly 170 percent since December, according to analysts at Bloomberg who track global trade. Oil and gas prices, which have eased substantially since the early stages of the war in Ukraine, have been mostly unaffected by the latest turmoil, but more prolonged disruptions could be felt by American consumers in the form of higher prices for energy and goods.

Kathy Bostjancic, chief economist at the insurance giant Nationwide, projects that the economy will experience at least a moderate recession this year, with unemployment rising to 5 percent.

But analysts on the optimistic side of the domestic economic debate are largely sticking to their view.

Joseph Brusuelas, the chief economist at RSM, a consulting firm, expects that inflation will continue to ease, “which will bolster domestic household balance sheets and boost consumption in the year ahead.”

Art Papas, the chief executive of Bullhorn, a software provider for staffing and recruitment agencies, says “there is a lot of pent-up demand” among his customers — midsize and large companies — as they anxiously wait for a green light on further hiring and investment.

“It feels like we’re in this weird state of balance,” he said, “which I’ve never seen before.”

Santul Nerkar contributed reporting.