With the average P/E ratio for the S&P 500 reaching the 45 level, some analysts have become increasingly concerned about the market being overheated and poised for a potential crash. While such a downturn can negatively affect many stocks, some businesses actually prosper during economic downturns, especially those that serve budget-conscious consumers.

Consumer stocks such as Amazon (NASDAQ:AMZN), BJ's Wholesale (NYSE:BJ), and Dollar General (NYSE:DG) could continue to drive investor returns under such conditions. Let's take a closer look at these three retail stocks that can succeed even when the broader economy stumbles.

Older couple staring at a laptop at their dining room table while as one of them holds a credit card.

Image source: Getty Images.

1. Amazon

The pandemic offered further proof that Amazon runs a business that can prosper in good times and bad. Moreover, the pandemic showed that Amazon can rely on its other business -- cloud computing -- as well. Amazon Web Services (AWS) accounted for the majority of Amazon's profits in the past few years. A recent example is how AWS helped the company's earnings growth continue when retailing profits took a hit as Amazon ramped up its one-day shipping operations.

Furthermore, market research firm Research and Markets predicts that the cloud computing industry will grow at an 18% compound annual growth rate through 2025. This increases the likelihood that AWS will continue to increase in size even if the market turns downward.

Despite the COVID-19-related hit to the broader economy in 2020, Amazon net sales increased 39% in 2020 compared to 2019. That continued in the first quarter of 2021 as net sales increased 46%. This allowed overall revenue to climb 44% in Q1 2021, with earnings rising by approximately 225%.

Additionally, the fact that the company generated $26.4 billion in free cash flow over the last 12 months helps the company hold one of the strongest balance sheets in corporate America.

For investors, Amazon stock continues to get cheaper despite its rising share price. It now supports a P/E ratio of approximately 65, down from 130 one year ago, taking the valuation to a multiyear low.

While we don't know what will cause the next economic stumble, physical stores are likely to remain open, and bargain hunters won't feel forced to turn to Amazon to find what they need. But the company has shown growth with or without a pandemic and it is on track to hit half a trillion in sales this year. Amazon's sales volumes and AWS's profits will help the company prosper in nearly any economic environment.

2. BJ's Wholesale

Interestingly, the last downturn may have helped BJ's. As the pandemic forced people out of work, consumers turned to the warehouse retailer for bargain foodstuffs. Its strategy of selling smaller portion sizes at lower prices than other warehouse retailers drew consumers. 

BJ's operates in 17 states, primarily on the East Coast. However, unlike warehouse retailers Costco and Walmart's (NYSE:WMT) Sam's Club, it has considerable room for expansion within the U.S.

Indeed, the company now faces near-term uncertainty as consumers return to pre-pandemic conditions. In the latest quarter (Q1 of fiscal 2021), revenue rose 2% from year-ago levels, while net income dropped 15%, mainly on increased expenses related to sales, general operations, and administration.

Nonetheless, revenue in fiscal 2020 surged 17% over 2019 levels. Also, net income rose 125% during that period on lower operating, pre-opening, and interest expenses.

In addition, revenue and earnings increases allowed the company to clean up its balance sheet. Stockholders' equity, the value of BJ's after liabilities are subtracted from assets, is nearly 13 times higher than one year ago. This leaves BJ's better positioned to expand to more unserved markets. That prospect also appears more attractive when you consider that BJ's P/E ratio of 16 is well under Walmart's 32 and Costco's 36.

BJ's will face intense competition from Sam's Club, Costco, and other retailers. Still, BJ's proved its appeal during the pandemic, and its competitive advantage could again become valuable should cash-strapped consumers look to save money.

A hand plants dollars in soil to see it grow

Image source: Getty Images.

3. Dollar General

Dollar General management says the company stands for "convenience, quality brands, and low prices," emphasizing a "hassle-free experience" at its neighborhood locations. Lately, it has stood out above other discounters by emphasizing moves into towns of fewer than 20,000 people. This means that 75% of Americans have a Dollar General within 5 miles of their homes. Because of their small size, many of these towns do not have a Walmart nearby, meaning less competition.

This consumer discretionary stock has also benefited from archrival Dollar Tree's (NASDAQ:DLTR) recent troubles. Dollar Tree primarily sells items for $1 or less. A dependence on low-cost Chinese goods to meet that standard has caused supply chain and tariff issues. Though Dollar Tree's Family Dollar chain sells items for over $1, Dollar Tree has struggled to integrate those stores since completing the acquisition in 2015.

Like BJ's, Dollar General saw a post-pandemic pullback. In the latest quarter, net sales dropped by less than 1% from year-ago levels. Nonetheless, net income rose 4% during the same period as the cost of goods sold fell by 4%. This stands in contrast to the pandemic-driven downturn in fiscal 2020 when sales rose 22% from 2019 levels. Also, net income surged 55% during that period as the cost of goods sold and selling, general, and administrative expenses increased at a slower pace than net sales growth.

Dollar General's P/E ratio of 19.6 slightly exceeds Dollar Tree's 16.2 P/E ratio. However, it faces less serious challenges than its main rival. Additionally, with locations convenient to most Americans, it has positioned itself to offer value to both shoppers and investors should another downturn occur.

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.