The gap between yields on shorter- and longer-term Treasurys narrowed at month’s end, reflecting the tension between investors’ expectations that interest rates will climb and their concerns about the prospects for longer-term growth.

Yields on longer-term Treasurys, which tend to fall when investors expect cooling economic growth, have retreated since approaching their 2021 highs earlier in October. The slide came after new data showed tepid growth and lingering inflationary pressures, intensifying some investors’ expectations...

The gap between yields on shorter- and longer-term Treasurys narrowed at month’s end, reflecting the tension between investors’ expectations that interest rates will climb and their concerns about the prospects for longer-term growth.

Yields on longer-term Treasurys, which tend to fall when investors expect cooling economic growth, have retreated since approaching their 2021 highs earlier in October. The slide came after new data showed tepid growth and lingering inflationary pressures, intensifying some investors’ expectations that the Federal Reserve will hasten interest-rate increases, slowing the economy.

Yields on shorter-term Treasurys, meanwhile, have continued to rise. The yield on the two-year Treasury, which tends to climb when investors expect rates to rise, settled at new yearly highs throughout the past week. It finished Friday’s session at 0.491%.

“The market is trying to figure out what the long-term outlook is here for both Fed policy and inflation,” said Kathy Jones, chief fixed-income strategist at Charles Schwab. “Those two things are getting investors rather muddled.”

Short-term government bond yields across the world have climbed in recent weeks after governments and central banks signaled tighter monetary policy. The Bank of Canada brought an end to its broad-based emergency-income benefits for households and businesses earlier this month, while the Bank of England has signaled that it is increasingly likely to raise interest rates in the near future, making it among the most hawkish of major developed market central banks.

The U.S. central bank is set to begin winding down its $120 billion-a-month bond-purchase program in November, sooner than some investors had anticipated. Analysts expect officials won’t raise rates before finishing that process.

Fed officials have said that much of the recent pickup in inflation is temporary and expect it to moderate in the years ahead. Investors and analysts also generally expect inflation to cool as businesses increase the supply of goods to meet consumer demand and supply-chain pressures ease from a return to more-normal spending patterns.

Many, though, have revised their forecasts upward in light of surging energy prices, rising rents and increasing evidence of a tightening employment market. Labor Department data released Thursday showed jobless claims fell last week to the lowest level since the pandemic began, a sign layoffs remain low as companies struggle to hire workers.

That is one reason investors continue to pull forward their expectations for when the Fed will raise rates. Federal-funds futures, which investors use to wager on interest-rate policy, recently showed a 77% chance of a rate increase by July 2022 and 89% by September 2022. That is up from around 15% and 27% one month ago.

A gauge of investors’ inflation bets, known as CPI inflation swaps, shows expectations that inflation will remain around 6% through February then drop sharply after, according to a recent Citigroup Inc. report.

The possibility of persistent supply-chain disruptions and a cold winter raising energy prices could keep near-term inflation elevated and prompt more bets on a rate increase in 2022, according to a recent TD Securities note. Those analysts expect the Fed to signal the course of increase during officials’ November meeting and the first to come in the latter half of 2023.

Investors have overreacted to shifts in the Fed’s policy messaging in the past. TD analysts note that when the Fed started to taper bond purchases in 2013 after the financial crisis, investors began expecting the first rate increase in just over a year, about a full year before it happened.

SHARE YOUR THOUGHTS

To what extent are you concerned about longer-term growth? Join the conversation below.

Mrs. Jones is recommending clients purchase Treasurys that mature in three to five years. She believes that the 10-year yield will rise to 2% by early next year and the Fed will start to hike rates by the second half of 2022 at the earliest.

“We will look to add more [longer-term Treasurys] to portfolios as rates rise,” she said. “But for now we see more risk to the upside and potential for [yield] curve steepening.”

Others said technical factors in the market may have spurred recent buying of longer-term bonds. Many investors are still sitting on large amounts of cash and the recent rise in yields may have attracted longer-term investors, such as insurance companies and pension funds, to restart purchases since paring back after the summer, Blake Gwinn,

head of U.S. rates strategy at RBC Capital Markets, said in a recent note to clients.

“The underlying wall of cash that weighed on rates through much of the summer may have peeked up to say hello,” he wrote.

Write to Sebastian Pellejero at sebastian.pellejero@wsj.com