Recessions are financially and emotionally trying events. It's fair to say that nobody likes a recession. But that doesn't stop them from happening as the so-called "invisible hand" works to clean up excesses built up in the good times. How can you protect yourself from these downturns? Consider buying gold, or gold mining stocks like Goldcorp (NYSE:GG), Barrick Gold (NYSE:ABX) or even the SPDR Gold Trust (NYSEMKT:GLD), when the financial world looks like it's going to end, gold starts dancing to its own tune.   

The last one was a big one

The most recent recession occurred between 2007 and 2009. It was a brutal and long economic downturn that was driven by the housing crisis and reverberated around the world. To give you an idea of how painful this period was for investors, the S&P 500 Index was down roughly 37% between December 1, 2007, and May 30, 2009. That hurts.

Gold bangles on a woman.

Image source: Getty Images.

But what happened to gold? The price of the yellow metal rose 24%! It wasn't a straight rise -- gold was down around 10% at one point -- but it never fell as much as stocks. In fact, when the recession first hit, and stocks began their descent, gold actually went up nearly 30%. Up 30% to down 10% is a big swing, of course, so it was a roller coaster ride for gold investors. However, overall, gold held its value at a time when stocks just kept falling.

And that's the gold story, summed up in a single recession. But let's dig into it a little bit.

The zombie apocalypse

I'm not going to suggest that the end of the world is upon us, and I don't believe in zombies (though I do like zombie movies). But for thousands of years, gold has been used as a store of wealth. It is a physical asset that has value in and of itself, and the gyrations of paper assets have little impact on it. If there were an event that led to monetary collapse, gold would likely be the primary fallback currency.

After all, the supply of gold is based on the mining activity of companies like Barrick Gold (NYSE:ABX), Gold Corp (NYSE:GG), and Newmont Mining (NYSE:NEM)...not a central bank deciding to create new money out of thin air by printing some paper with pictures of dead presidents on it. And, despite the efforts of medieval alchemists, no one has yet figured out how to create gold without digging it out of the ground. In other words, supply is inherently limited.

Gold Price in US Dollars Chart

Gold Price in US Dollars data by YCharts.

This is why, when the going gets tough, investors flock to gold. Although the number changes each year, investment usually accounts for around 30% of annual demand for gold. That's a big number that includes gold coins and, increasingly, exchange-traded funds like SPDR Gold Shares (NYSEMKT:GLD) or iShares Gold Trust (NYSEMKT:IAU). Exchange traded funds that track the price of gold are probably the easiest and quickest way to get gold into your portfolio since you don't have to physically take possession of the metal or worry about where and how to store it.    

Interestingly enough, one of the smallest sources of demand for gold comes from industry, largely technology, at around 10% or less. So, a corporate slowdown won't have a huge impact. That said, jewelry is easily the largest source of demand, making up around 50%. Recessions will clearly lead to a slowdown on this front but think that through for a second. If unemployment rises to 10%, that means 90% of workers are still on the job earning money. They may be less likely to spend, but they won't stop spending.  

Gold Price in US Dollars Chart

Gold Price in US Dollars data by YCharts.

Jewelry demand is more resilient than you'd probably imagine. And it's important to note that the biggest sources of gold jewelry demand are foreign countries like India and China. A U.S. recession won't necessarily change the desire for jewelry in those countries. Gold jewelry is also a status symbol, and as these countries move up the socioeconomic ladder, demand for gold jewelry is likely to rise over time.

Dancing to a different beat

There are a lot of moving parts, here, but you can easily see why gold tends to move a little differently than stocks and other paper assets. To put a number on that, the World Gold Council tracked the correlation between gold and the S&P 500 Index between 1987 and 2010. Basically, they were looking to see how well the two tracked each other over time.    

The most interesting result of this effort? When stock prices were moving dramatically (two standard deviations from the norm), the correlation with gold turned negative. In other words, in a recession, when stock prices are likely plummeting, you'd expect gold to be moving the other way.  

That's priceless if you're looking for a way to diversify your portfolio. Just look at the graphs of the last two recessions above, and you'll get a visual of what that means. Those graphs visually explain why investors buy gold in a recession.

Don't forget about gold

Gold probably isn't the first thing that comes to mind when you think about investing. But it has an important role to play, and with the advent of exchange-traded funds like SPDR Gold Shares and iShares Gold Trust, it's easier to buy gold than ever before. And, as we've seen, one of the key times to start thinking about the yellow metal is in recessionary environments. To put it simply, when stocks are getting dumped, lots of smart investors are turning to gold.

Reuben Brewer has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.