By Min Zeng

U.S. government bonds posted the biggest quarterly selloff in more than two decades and logged a second consecutive year of price declines, with the $13.9 trillion market punctuated by a roller-coaster ride during 2016 that few money managers and traders saw coming.

The yield on the benchmark 10-year Treasury note closed at 2.446% on the last trading session in 2016, up from 2.273% at the end of 2015. Yields rise as bond prices fall.

The bond market shut at 2 p.m. EST Friday and will remain shut until Tuesday in observance of the New Year's holiday.

The yield's moderate rise this year belies one of the biggest bond price rallies since the financial crisis. The yield tumbled more than 0.9 percentage point between the end of last year and its record low of 1.366% set in early July. Since then, in one of the largest selloffs over the past decade, it has climbed by more than 1 percentage point. The yield climbed 0.841 percentage point between October and December, the largest quarterly gain since 1994.

"There have been a lot of unexpected twists and turns throughout the ride in 2016," said Scott Buchta, head of fixed-income strategy at Brean Capital. Mr. Buchta said he expects to see higher volatility for bond yields in 2017.

The recent selloff has shrunk the total return from Treasury bonds to 0.82% this year through Thursday, according to Bloomberg Barclays bond indexes data. The S&P 500 stock index logged a 12% return over the same period, according to FactSet. The return includes price changes and interest or dividend payments.

In the U.S. fixed-income market, junk bonds, or corporatedebt sold by lower-rated firms, were the rock star, returning 17% this year through Thursday. U.S. Treasury inflation-protected bonds, or TIPS, have posted a return of 4.3% amid strong demand for inflation hedging. U.S. investment-grade corporate bonds have logged a return of 5.8%, and U.S. municipal bonds have posted a return of 0.2%.

Investors flocked into the world's largest bond market for safety when 2016 started, as a sinking Chinese stock market and yuan heightened worries over the global economy and caused a swoon in U.S. stocks. The Treasury bond market got a strong boost as yields fell to record lows after the U.K.'s vote to leave the European Union in late June.

Over the past few months, fortunes have turned and sent bond yields climbing, after global data drove a shift of market expectations toward stronger growth, higher inflation and potentially a faster pace of interest-rate increases by the Federal Reserve.

Thenarrative has been accentuated by the prospect of greater spending, lower taxes and lighter regulations proposed by President-elect Donald Trump. Inflation chips away bonds' fixed returns over time and is considered a big threat to long-term government bonds.

In addition, higher fiscal spending typically requires more issuance of Treasury bonds for funding, and investors are concerned that more debt supply would pressure yields higher at a time when demand for bonds has diminished.

Despite the rise, bond yields are still low from a historical standpoint. The 10-year yield was less than half its trading level in 2007. From a broader perspective, the yield has been falling after closing at a record high of 15.819% on Sept 30, 1981.

Some analysts believe that the long cycle of lower yields is coming to an end and that the record close low set in July marks the bottom of the 10-year yield.

Others are hesitant, given that thebond market has wrong-footed those calling for the end of the bull market in recent years. They caution that investors betting on higher yields have pinned high hopes on Mr. Trump's fiscal stimulus and its boost to the economy.

If Mr. Trump's policy outcome fails to deliver, growth optimism may wane, and investors are likely to cut back negative wagers against the bond market, sending yields lower, analysts say.

"The market pendulum has been swinging into euphoria with the prospect of swift fiscal stimulus," said Jason Evans, co-founder of hedge fund NineAlpha Capital LP in New York.

Mr. Evans said he is refraining from large bets on higher yields at the moment and will wait for fiscal policy details as well as economic data in the new year to make investment decisions.

The bond market has regained some poise lately. The 10-year yield has pulled back after closing Dec. 16 at 2.6%, the highest since Sept. 2014.

Write to Min Zeng at min.zeng@wsj.com

(END) Dow Jones Newswires

December 30, 2016 15:17 ET (20:17 GMT)

Copyright (c) 2016 Dow Jones & Company, Inc.