Want a bargain? Look at munis

The downgrade of Puerto Rico’s debt to junk status in February capped a bleak year or so for the municipal bond market. Fixed-income prices in general took a hit last spring after the Federal Reserve signaled that it would soon begin tapering its bond purchases. And the July bankruptcy filing by Detroit added to the muni agita. The total return for the Barclays Municipal Bond Index was -2.6% in 2013, almost double the loss for the Barclays U.S. Aggregate Bond Index, as some $58 billion was yanked out of muni bond funds. That exodus, say many experts, has created an attractive buying opportunity.

Signs of an overcorrection in muni bond prices abound. Because the interest payments on munis are exempt from federal (and sometimes state and local) taxes, high-quality, longer-term municipal bonds have historically yielded less than Treasuries of comparable maturities. But as of mid- February, the average yield on AAA-rated 30-year muni bonds was 3.9%, topping the 3.7% rate for 30-year Treasury bonds. Factoring in the tax benefit, muni bonds in general “should easily outperform other fixed-income asset classes in 2014,” says UBS municipal analyst Kristin Stephens.

State and local governments are also benefiting from an improving economy. Tax revenues at both levels have increased for 13 consecutive quarters, according to the U.S. Census Bureau. And rising interest rates have helped shore up the finances of public sector pension plans. Ratings agency Moody’s estimates that rising rates in 2013 reduced pension liabilities for the typical public sector plan by about 8%.

Many pros say the best bargains now lie with high-yield municipal bonds, issued by governments with less-than-stellar credit ratings. “The high-yield market is positioned for outperformance,” says Bob Doll, senior portfolio manager with Nuveen Investments. In return for a greater risk of default, the bonds offer fatter yields. And right now investors are being well compensated to take the extra risk. The difference between the yield on junk-rated and investment-grade munis with comparable maturities is now about 3.7 percentage points, well above the 20-year average spread of 2.9 points. And defaults have been declining: 0.81% of bond deals in the S&P Municipal Bond High Yield Index defaulted in 2013, down from 1.5% in 2011, according to S&P Capital IQ.

The easiest way to get diversified exposure to high-yield munis is through a mutual fund or an ETF. Prices for bonds with shorter maturities are less susceptible to getting whacked if interest rates continue to rise, as many economists predict. One high-yield choice that helps hedge against that risk is Pioneer High Income Municipal, which yields 5.6% and holds bonds with an overall duration of just under six years. Another option, Market Vectors Short High-Yield Municipal Index ETF, has a shorter portfolio duration of 4.8 years and carries a 4.5% yield. Both funds should benefit from a muni rebound.

A former compensation consultant, Janice Revell has been writing about personal finance since 2000.

This story is from the March 17, 2014 issue of Fortune.