In these volatile times, you may wish to consider investing in a safer stock that you can confidently rely on for dividends. Even though the S&P 500 index has just topped the all-time high it reached in late February, just as the investing world began worrying about the novel coronavirus, there remains a lot of uncertainty about the pandemic and the overall economy.

The stock market's sharp upturn comes as the U.S. and other countries are officially in a recession. Traditionally, investors could rely on Walmart (NYSE:WMT) to perform well in a challenging environment. Is this still the case?

A piggy bank with an umbrella over it.

Image source: Getty Images.

A strong business

Walmart has thrived since opening its first discount store in the early 1960s with a simple formula that concentrates on keeping costs down so it can offer low prices. That's a winning combination, especially when times get rough.

When the economy hit the skids last decade, the company did just fine. In fiscal 2008 (ended Jan. 31, 2008), its U.S. same-store sales rose 1.6%. In the subsequent two years, there was a 3.5% increase and a 0.8% decline. But fiscal 2010's fall was partly due to lower gas prices.

More recently, in the current downturn, it has posted strong results. In its fiscal second quarter, which ended on July 31, U.S. comps at its namesake Walmart stores increased 9.3%, driven by general merchandise and food. The company's total revenue rose by 7.5%, excluding the effects of foreign exchange, to $140.2 billion. This is a testament to Walmart's appeal to shoppers because other retailers started reopening physical stores during the quarter, meaning it was not merely taking advantage of the situation caused by the pandemic.

Its quarterly adjusted operating income rose by nearly 19% to $6.6 billion, despite higher expenses related to COVID-19.

It is also pushing to fend off threats from e-commerce companies, notably Amazon. In the current quarter, its online sales nearly doubled. The company is also reportedly preparing to launch Walmart+, its own subscription service to compete with Amazon Prime. The company plans to charge $98 a year, compared with Prime's $119. While news reports have stated it pushed back the timing of the launch from July, I expect that when it debuts, Walmart will use its vast resources to push the service hard.

Approaching dividend royalty

The next question you probably have is: How does an economic slowdown affect Walmart's dividend, which yielded 1.6% at Tuesday's close?

For starters, paying the dividend is very important to the company. It first declared a dividend way back in 1974 and has subsequently raised it annually. After the board of directors hiked April's dividend by a penny to $0.54, this brought the streak to 47 straight years. I find it comforting to know that Walmart has accomplished this feat in all kinds of economic environments, including high inflation, stagflation, and recessions.

Already a Dividend Aristocrat, it is likely that in a few years, Walmart will become a Dividend King (members of the S&P 500 that have raised their dividends annually for at least a half-century).

Walmart's first-half free cash flow (operating cash flow minus capital expenditures) was $15.4 billion. With dividends of $3.1 billion, there is a nice cushion.

This is one of the strongest, most stable companies out there. You can confidently invest knowing its deceptively simple formula of low costs and everyday low prices works well when the economy is sluggish. That's why you can rely on Walmart's dividend continuing.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.