On Friday, the bond market once again flashed what has historically been a reliable sign of an impending U.S. recession -- an inverted U.S. Treasury bond yield curve -- after trade tensions with China heated up, triggering a 2.6% sell-off in the broader stock market. This indicator has occurred several times since Wednesday, Aug. 14, when it spooked the market and resulted in the S&P 500 index falling nearly 3%.

The inverted yield curve first sounded the economic-downturn-ahead alarm in March, but last week marked the first time since late 2005 that there was an inversion on what's considered the main part of the yield curve.

If this leading inverse economic indicator still has its good predictive mojo, the stock market's roaring, decade-long bull market could be coming to an end. Here's what you should know.

"Economic uncertainty ahead" on a yellow traffic sign with a stormy sky and lightning in the background.

Image source: Getty Images.

What's an inverted yield curve?

An inverted yield curve occurs when interest rates on bonds with longer maturities are lower than those on bonds with shorter maturities. It occurs because investors are anxious about the economic climate and are pouring money into longer-term bonds, which they see as safe havens. As money flows in, the prices on these bonds go up -- in a typical supply/demand fashion -- while yields go down.

It's worth noting two things: Some economists believe that the inverted yield curve doesn't have the same predictive power that it once possessed, and there can be a considerable time between this phenomenon and the start of a recession. The length of time between an inverted yield curve and the official start of a recession has ranged from several months to about two years.

I think it's more likely than not that a recession is on the way, as it seems wise to bet on an economic indicator that has such a good track record (which we'll get to in a moment). The timing will likely depend on several factors, including the Federal Reserve's future actions on interest rates and how things play out with the Trump administration's trade war with China.

Recent inverted yield curves

On Aug. 14, the yield on the benchmark 10-year U.S. Treasury note briefly dipped below the yield on the 2-year note, resulting in an inversion on the main part of the yield curve. The yield curve, however, recovered later in the day. This scenario has played out several more times since then, with Friday being the most recent. 

Rather than looking at yield curves, it's easier to picture things using a chart showing the spread between the yields of the two notes. And it's also easiest to visualize things if you focus on Aug. 14 and Aug. 22. During at least one point on each of these days, the yield spread line in the following chart fell under 0.00% (the horizontal or x-axis), meaning the 10-year note was yielding slightly less than the 2-year note. In all the instances since last week and through the time of this writing (mid-afternoon Friday), the yield curve reverted back to its usual shape by the end of the trading day, which is why none of the yield spread lines in this chart show as below 0.00%. 

10-2 Year Treasury Yield Spread Chart

Data source: YCharts. Treasury securities that mature in one year or less are called "bills," those with terms of two, three, five, or 10 years are "notes," and the 30-year Treasury is a "bond." 

How good is the inverted yield curve at predicting recessions?

This question can be answered in two words: darn good.  A 10-2 inverted yield curve has preceded every U.S. recession over the last 50 years -- and there have been seven of them over this period. 

In the below chart, you can see that the yield curve between the 10-year and 2-year Treasury notes inverted before each of the five recessions (indicated in gray bands) over the last four decades. (This is as far back as YCharts data goes.) The inversions occur when the line on the graph dips below 0.00%. (The label isn't visible, but it's the horizontal line just below the "0.01%," which is the Aug. 22 yield spread between these two notes.)

But what about false alarms, or inverted yield curves popping onto the scene with no recession following? Going as far back as the 1960s, there has been only one false positive -- it occurred during the mid-'60s. So the inverted yield curve is not the boy who cried wolf. 

10-2 Year Treasury Yield Spread Chart

Data by YCharts. 

Homing in on the Great Recession

The following chart allows us to more clearly see when the 10-2 Treasury yield curve inversions occurred that preceded the start of the Great Recession, the longest U.S. recession since World War II and the deepest one since the Great Depression, which began in 1929 and ended with the start of WWII. The Great Recession technically lasted from December 2007 to June 2009, but many of its negative effects lingered for years after its official end. The 10-2 Treasury yield spread's first dip below 0.00% came in late December 2005, but the alarm bells really went crazy from about mid-2006 through early 2008 -- or starting about 1-1/2 years from when the recession officially began. 

Of course, this isn't to say that this pattern has been the same for every recession or will be the same for the next big economic slump. But I think the saying that applies here is that while history doesn't repeat itself, it often rhymes (original source disputed). 

10-2 Year Treasury Yield Spread Chart

Data by YCharts. 

The broader stock market got clobbered during the recession. In the 18 months that the Great Recession gripped the nation and the world, the S&P 500 index (including dividends) fell a whopping 36%. Moreover, it took years for the various stock indexes and many stocks to climb back to their former levels. 

Not all stocks fell during the recession -- and in fact, some did quite well. The following chart includes 10 stocks and one exchange-traded fund (ETF) that gained during this adverse economic period. These investments shouldn't be considered recommended buys, nor is this list all-inclusive -- it's simply meant to show that there are winners during recessions and to illustrate the types of stocks that tend to hold up or even thrive when the economy tanks. Perhaps not surprisingly, half of the stocks are dividend payers.

^SPXTR Chart

Data by YCharts.

The question that comes to mind here is, How have these stocks performed since the start of the recession? 

^SPXTR Chart

Data by YCharts.

All the recession gainers have outperformed the market since the start of the Great Recession, except for generic drugmaker Teva Pharmaceutical and the ETF, iShares Gold Trust. (We'll get to all of the stocks in a moment.) There's surely some self-selection going on here: Companies whose stocks performed well during the recession were probably generally hardier than many other companies going into it. So we'd expect at least many of them to continue their outperformance during the economic recovery, too.

And here's a sampling of eight stocks that were quite resilient during the recession, suffering only single-digit losses. They're all dividend payers, except for Bridgford Foods

^SPXTR Chart

Data by YCharts.

And how have these stocks performed from the start of the last recession until now?

^SPXTR Chart

Data by YCharts.

Interestingly, all eight stocks have outperformed the market since the start of the recession. We'll get to these stocks below.

Types of stocks that tend to hold up during tough economic times

Companies that sell small indulgences ("lipstick stocks") 

During difficult economic periods, it's natural that people will often put off buying big-ticket items. But -- and this might seem counter-intuitive -- many folks will actually increase their spending on affordable small indulgences, according to some research. The reasoning goes that they want to avoid feeling deprived, and are rewarding themselves for making larger sacrifices. This phenomenon is called the Lipstick Effect. The term was coined in the early 2000s by Leonard Lauder, then chairman of Estee Lauder, who found that in tough economic climates his company's sales of cosmetics increased. 

Since then, some studies have suggested that we need to kiss off lipstick sales as an inverse indicator of economic health, but there's research supporting the general theory. In other words, the Lipstick Effect could use a new first name.

Several of the stocks in the recession gainers charts could be considered "lipstick stocks": fast-food leader McDonald's (NYSE: MCD)National Beverage, which is best known for its LaCroix sparkling water, but also makes soft drinks, juices, and energy drinks; and J&J Snack Foods, which produces niche snack foods and frozen beverages, including Superpretzel soft pretzels and Icee frozen beverages. Video-steaming pioneer and leader Netflix (NASDAQ:NFLX) has been a massive winner because it disrupted a few huge industries -- including movie theater chains and cable TV companies -- but it also fits into the lipstick stock category. 

As for dividends, McDonald's and J&J Snack stocks are yielding 2.1% and 1.1%, respectively, as of Aug. 22. National Beverage and Netflix don't pay dividends.

The two charts showing the stocks than remained relatively steady during the recession include chocolate maker Hershey and leading toy maker Hasbro could also fall into the lipstick stock classification. Both stocks pay dividends, with Hershey's yielding 2% and Hasbro's 2.4%.

Close-up of water pouring into a glass.

Image source: Getty Images.

Water utilities

Most consumers in developed countries are not going to cut back on their everyday water use during even the most challenging economic conditions, which makes water utilities a great choice to weather recessionary storms. Three water utility stocks -- Connecticut Water, California Water Service, and York Water -- are in the charts of the stocks that remained relatively steady during the recession. There are plenty of solid dividend-paying stocks in this group, though American Water Works (NYSE:AWK) is the best in class for the long run, in my opinion. The New Jersey-based company's industry-leading size and geographic diversity provide it with a leg up in the acquisition realm, which is a notable advantage since the U.S. water utility industry is quite fragmented. Its stock's dividend yield is 1.6%, as of Aug. 22. 

American Water went public in late April 2008, so it wasn't trading for about the first five months of the Great Recession. That said, the stock lost nearly 13% of its value during the portion of the recession when it was trading and has returned a mighty 724% since its initial public offering (IPO), more than four times the S&P 500's 168% return. Of course, past performance doesn't guarantee future performance, but good performance over the long term does often suggest that a company has a solid competitive advantage.

Other types of utilities

While electric and gas utilities generally hold up decently during economic downturns, they're usually not as recession-resistant as water utilities. Consumers are more apt to scale back on the commodities these utilities provide than to dial back their water usage. While electric-utility powerhouse NextEra Energy (NYSE:NEE) didn't make the charts (its stock declined nearly 16% during the recession), it's a top choice to juice up your long-term returns. Along with owning two electric companies in its home base of Florida, it's the world's largest generator of renewable energy from the wind and sun. NextEra stock's dividend yield is currently 2.3%. The stock has returned 361% since the start of the last recession, more than twice the broader market's return. 

Consumer staples

Even in dim economic environments, people tend to still eat meals, wash their hair, clean their houses, and so forth. Two consumer staple stocks in the recession gainers charts are poultry producer Sanderson Farms and Lancaster Colony, which makes specialty food products for the retail and food service markets. 

A box of Arm & Hammer baking soda.

Image source: Church & Dwight

There are a few consumer staples in the charts of the stocks that remained relatively steady during the Great Recession. Home and personal care product manufacturer Church & Dwight (NYSE:CHD) makes a good investment choice in this category. The 170-plus-year-old company has done a great job leveraging its iconic and ultra-versatile Arm and Hammer brand baking soda into a wide range of value-added products. Also, in the same charts are Bridgford Foods, which churns out foods such as frozen bread dough and beef jerky, and Flowers Foods, a major producer of packaged bakery goods. Dough isn't the only thing that rises at Flowers, as it has a solid track record of raising its dividend, which is currently yielding 3.3% -- the richest dividend yield of the stocks discussed in this article as of Aug. 22. 

Beyond Flowers, the dividend yield roundup: Sanderson 0.9%, Lancaster Colony 1.7%, and Church & Dwight 1.2%. Again, Bridgford doesn't pay a dividend. 

Healthcare companies

In general, the stocks of generic drugmakers remained relatively healthy during the Great Recession. This makes sense, as some consumers probably substitute generics for their name-brand prescription drugs when they're feeling anxious about their economic well-being. Shares of Teva (in the recession gainers charts) and Allergan (not in the charts) both rose in the single digits during the recession. Teva stock -- which doesn't pay a dividend -- has since plunged, while Allergan -- which is yielding 1.8% -- has returned 475% since the start of the recession through Aug. 22, about triple the broader market's return.

Discount retailers

When consumers feel unsure or worse about the economy, they tend to be more price-conscious. During the Great Recession, this benefited the world's largest retailer, Walmart (NYSE:WMT), which focuses on low prices, and Dollar Tree, which specializes in very low-priced items. Shares of Walmart returned more than 7% during the 18 months of the recession, while Dollar Tree stock was apparently growing money on trees, with about a 56% gain. Both stocks have also outperformed the market since the start of the recession. I'm not fond of either one: Amazon has been eating Walmart's lunch in the e-commerce space, which is steadily growing, and Dollar Tree doesn't have a solid moat to keep competitors at bay. Walmart's dividend is yielding 1.9%. Dollar Tree doesn't pay a dividend.

Companies whose products allow people to postpone major purchases

Auto parts retailer O'Reilly Automotive (in the recession winners charts) falls into this category. O'Reilly doesn't pay a dividend.

Gold and silver

In times of economic uncertainty, many investors flock to gold and silver, which are seen as safe havens. These precious metals are also viewed as inflation hedges. Not surprisingly, iShares Gold Trust was a big winner -- it popped about 24% -- during the last recession, while the same company's Silver Trust (not shown) also rose. Both funds have significantly underperformed the market since the start of the recession. This also isn't surprising, as precious metal investments usually don't shine when the economy is humming along and consumer confidence is high. In general, this space is best left to short-term traders, in my opinion. These are not "set-and-forget" stocks.

What about "sin stocks"?

Conventional wisdom has it that so-called sin stocks -- such as those in the tobacco, alcoholic beverage, and gambling spaces -- tend to do relatively well when they economy goes south. I didn't find that this held true during the Great Recession. My spot check of the stocks of top companies in these three realms showed that most of them struggled during the recession.

Now is a good time to review your stock portfolio

Now is a good time to review your portfolio and consider shifting to a more defensive stance. That generally means favoring the dividend-paying stocks of stable companies whose products and services are in demand no matter what the economic climate. Two of my favorite dividend payers that fit the bill are American Water and NextEra Energy. That said, the stocks in the "lipstick stocks" and consumer staples categories are worth further exploring, particularly Netflix, Church & Dwight, and J&J Snack Foods.  

Even if you believe a recession is on the near-term radar, it's generally not a good idea to get out of the stock market entirely or to sell all of your growth stocks. If you do, you risk missing the often explosive early stages of the next big leg up, as market timing is notoriously difficult.