General Mills' (NYSE:GIS) stock has rallied nearly 20% this year against the S&P 500's 1% decline. The rally was unusual for the packaged foods giant, which has underperformed the index over the past decade, but it was driven by two main tailwinds.

First, macro headwinds -- including the U.S.-China trade war, COVID-19 crisis, and high unemployment rates -- caused many investors to buy defensive stocks with high dividend yields. Second, the COVID-19 crisis sparked waves of panic shopping and boosted sales of General Mills' products, including Cheerios cereal, Yoplait yogurt, and Häagen-Dazs ice cream.

Will those tailwinds fade and cause General Mills' stock to give up its gains? Or does this defensive dividend stock still have room to run in a volatile market?

A bowl of Cheerios cereal.

Image source: Getty Images.

Reviewing General Mills' challenges

General Mills has struggled with competition from healthier and private label brands over the past few years. To address those challenges, it divested its weaker brands, acquired growing brands like the organic food maker Annie's, refreshed its classic brands with new variants like Blueberry Cheerios, and expanded into the premium pet food market by buying Blue Buffalo.

Unlike its rival Kraft Heinz (NASDAQ:KHC), which cut costs to boost shipments, General Mills raised its prices to protect its margins. It also stuck to its "Holistic Margin Management" (HMM) plan, which cuts its operating expenses by installing energy-efficient technologies, optimizing its distribution network, and reducing its packaging costs.

These strategies enabled General Mills to generate consistent earnings growth even after its organic sales growth stalled out and it suspended its buybacks in 2018 to reduce its debt after buying Blue Buffalo.

Accelerating sales and earnings growth in 2020

General Mills' growth accelerated significantly near the end of fiscal 2020, which ended on May 31, as COVID-19 shopping sprees drove an "unprecedented increase in demand for food at home."

Blue Buffalo's sales also spiked as pet owners stocked up on pet food and supplies. As a result, General Mills posted its strongest revenue and earnings growth in years in fiscal 2020:

Growth (YOY)

2016

2017

2018

2019

2020

Organic Sales

0%

(4%)

0%

0%

4%

Adjusted EPS*

5%

6%

0%

4%

12%

Source: General Mills annual currency basis.

However, the company didn't provide any guidance for 2021, citing the "highly uncertain" challenges related to COVID-19. It still expects its food sales to remain "elevated," but warns those gains could be offset by difficult comparisons against a 53rd week in 2020, an extra month of pet product sales, and the COVID-19 sales spike at the end of the year.

For now, General Mills plans to continue executing its HMM initiatives to free up more cash for investments, reduce its debt, and keep its adjusted operating margin "approximately in line" with its margin of 17.3% in 2020. In other words, General Mills' revenue growth will likely decelerate, but it will likely defend its margins, earnings, and dividends (which haven't been raised since 2017) with careful cost-cutting measures.

Analysts currently expect its revenue and earnings to decline 3% and 2%, respectively, this year. Those growth rates are tepid for a stock that trades at 18 times forward earnings, but its forward dividend yield of 3.1% and its reputation as a defensive investment should set a floor under the stock.

Buy General Mills if you're expecting a recession

General Mills' stock has underperformed the S&P 500 over the past 10 years, but it's outperformed the index during severe market downturns. Here's how General Mills fared against the S&P 500 during the Great Recession:

GIS Chart

Source: YCharts

Therefore, General Mills is a compelling investment if you expect the market -- which doesn't seem to fully reflect the dangers of COVID-19, the trade war, high unemployment rates, and other macro challenges yet -- to crash. Even if you're optimistic about the market's near-term prospects, it wouldn't hurt to hedge your bullish bets with some shares of General Mills, which will likely remain a top defensive stock for the foreseeable future.