Short-term Treasury yields are spiking to new highs, making the risk-free notes even more attractive for investors seeking safety and income at a time when market returns are scarce. The yield on the 2-year Treasury popped to 4.1% on Wednesday, the highest level for the note since 2007 . Bond yields move inversely to their prices. The move came after the Federal Reserve raised rates by 0.75 percentage point in an effort to tame inflation and indicated more hikes were on the horizon. In August, the consumer price index rose 0.1% . Economists surveyed by Dow Jones expected a decline of 0.1%. The 2-year note is at the point on the Treasury yield curve that is most sensitive to rate hikes by the Federal Reserve . With the yield curve inverted, short-term notes now have higher yields than longer-term ones. These short-term bonds are also now more compelling considering stocks’ lackluster performance this year. The S & P 500 is down nearly 19% in 2022. Bond king Jeffrey Gundlach, CEO of DoubleLine Capital, said in a recent webcast that after several brutal years, the fixed income market is now the place to be . “The opportunities are more exciting now than any time, in my view, in the past 10 years,” he said. Gundlach’s firm recently purchased long-term Treasurys. CNBC’s Jim Cramer, on the other hand, bought 2-year Treasury notes for his personal portfolio. For the first time in a long time, the yields are more competitive with stock returns, he said. With short-term notes, investors can get the high yield without a long-term commitment. For those looking to get a piece of the action, here’s what you need to know. A direct purchase from the government You can buy Treasurys directly from the U.S. government through its website, TreasuryDirect.gov . You’ll need to set up an account and link your bank to the website. The notes are sold in $100 increments and are generally issued within one week of the auction date. Auctions for the 2-, 3-, 5- and 7-year Treasurys occur every 4 weeks, while the 10-year auction occurs quarterly. Purchasing the notes makes income planning easy. “If you buy an individual Treasury and hold it to maturity, you know what your interest is going to be and you know what your maturity value is,” said chartered financial analyst Tim Utecht, chief investment officer at Life Planning Partners, based in Jacksonville, Florida. “You know exactly what you’re going to get.” You’ll get paid interest twice a year. If you hold the Treasury until it matures, you aren’t affected by market risk. The downside of owning the security instead of investing in a Treasury fund is the lack of diversification, unless you are laddering bonds yourself. You’ll also have to make sure you buy the right Treasurys based on your objectives and time horizon. The investments are also separate from your other accounts, said certified financial planner Diahann Lassus, managing principal at Peapack Private Wealth Management in New Providence, New Jersey. “For people who want to see everything together, it is a little more difficult,” she said. You also can’t buy them in your IRA or Roth IRA, which Lassus thinks is the biggest downside. If you want to sell the bond before it reaches maturity, you can’t do it on the government website. Instead, you’ll have to transfer it to a bank, broker or dealer. Buying Treasurys from a brokerage You can also purchase Treasury notes on the secondary market, going through a brokerage firm. You’ll still get all the advantages of owning the security directly. For Utech, this is the easiest way to buy the bonds, calling the government website “a bit cumbersome.” Online brokers like Fidelity and Charles Schwab have tables that list the yields on various Treasurys, so you can compare products, he said. In addition to offering secondary-market bonds, both Fidelity and Schwab sell new issue Treasurys. Also be aware that you may not get the exact time horizon on the note on any secondary Treasury purchases, Utech said. Be sure to check on any minimum purchase requirements and fees involved. At Schwab and Fidelity, for instance, it’s free to buy Treasurys online, but a broker-assisted trade is $25 and $19.95, respectively. At Fidelity, the minimum purchase is $1,000 for Treasury notes. What Lassus likes about going through a brokerage is the fact that you have the ability to have your investments all together and you can even add them to an IRA or Roth IRA, she said. Exposure through a bond fund You can also get exposure to the bond market through mutual funds and exchange-traded funds. “It provides immediate diversification,” Lassus said. For instance, a short-term Treasury bond fund could have issues with maturities ranging between one and three years. You can buy them through your brokerage, which might also make it easier to track performance alongside the rest of your holdings. See below for four short-term Treasury funds. However, funds can suffer price dislocation in a year like this one and you have the prospect of losses. Also, income payments can fluctuate since you have different bonds in the fund. Be aware of any fees involved, which could take a bite out of your returns. Funds also have turnover and therefore are subject to capital gains tax, unlike individual bonds.