Holdings of U.S. government debt by overseas investors declined the most in almost two years in September as yields on Treasurys climbed from near-record lows.

Foreign holdings of Treasury debt declined 1.2% to $6.78 trillion, the biggest drop since the end of 2017, according to data released by the Treasury Department late Monday. Demand for the debt from foreign investors at September’s auctions of new Treasurys was the lowest since before the financial crisis, according to separate data from the agency.

The yield on the benchmark 10-year Treasury note declined for a second consecutive session Tuesday, settling at 1.785%, according to Tradeweb, compared with 1.808% Monday. It reached a multiyear low of 1.456% in early September.

“Foreign ownership of Treasurys hasn’t kept pace with issuance,” said Jon Hill, a government debt strategist at BMO Capital Markets.

The decline in holdings was led by foreign central banks. Officials in some emerging markets could have been selling U.S. assets to defend their currencies against the dollar, Mr. Hill said.