These are the areas of the stock market where investors should be when interest rates are rising

When interest rates are rising, sectors like financials and energy tend to beat the rest of the stock market, historical analysis shows.

CNBC used analytics tool Kensho to determine the best-performing sectors in the S&P 500 when the 10-year Treasury note yield increased 25 basis points or more over a span of 30 days. There have been 18 instances of such a move happening since 2008.

The 10-year yield surged about 18 basis points last week alone to 3.23 percent and investors are scrambling to play the impact as these higher rates ripple through the economy. The U.S. Treasury market is closed Monday in honor of the Columbus Day holiday.

The Financial Select Sector SPDR fund (XLF) returned an average of 3.1 percent over a one-month span when rates were rising sharply, according to Kensho. The Energy Selector Sector SPDR fund (XLE) averaged a gain of 2.8 percent in such instances.

Banks turn a profit by charging borrowers higher, longer-term interest rates compared with the lower, short-term interest rates they dole out to savers. Bank of America is up 7.8 percent in the last three months; J.P. Morgan Chase is up 10.1 percent; and Citigroup is up 7.8 percent. The Financial Select Sector ETF is up 5 percent over the period.

WTI crude futures, meanwhile, closed up 1.5 percent for the week last Friday, their fourth straight positive week for the first time since January.

Other winning sectors when rates rise include consumer discretionary and technology stocks, which return 2.3 percent and 2 percent, respectively, in such instances.

Recent economic data — such as historically low unemployment and expanding corporate profits — have helped buoy interest rates in the past few weeks.

On Friday, the government said the unemployment rate dropped to 3.7 percent, a level not seen in nearly 50 years. Average hourly earnings, meanwhile, rose 8 cents — or 0.3 percent — over the month, matching August's gain and hinting at burgeoning inflation.

The positive economic data has also helped the Federal Reserve justify its third quarter-point increase in the federal funds rate in September. The central bank also upped its anticipation for economic growth this year to 3.1 percent, citing manageable inflation and an unemployment rate of 3.9 percent. For his part, Fed Chair Jerome Powell said Wednesday that the central bank is "a long way" from a neutral level of interest rates, implying more rate hikes to come.

Worst performers

The quick rise appeared to catch stock investors unprepared, with the S&P 500 clinching its first back-to-back weekly decline since late June by Friday's close.

Lagging sectors include bond-proxy utilities stocks as well as health care.

CNBC again used analytics tool Kensho to determine the worst-performing sectors in the S&P 500 when the 10-year Treasury note yield increased 25 basis points or more over a span of 30 days.

The Utilities Select Sector SPDR ETF is up only 1.2 percent in the past three months, underperforming the S&P 500's 4.5 percent gain.

Atlanta-based Southern Co., a gas and electric utility holding company, is down more than 8 percent in the past three months, while NextEra, Duke Energy and Dominion have all underperformed the broader market.

These stocks usually pay high dividends, which become less attractive when interest rates rise.

WATCH: Buy individual bonds with laddered maturities, Sarian Group managing director says