Lower consumer confidence in the economy and rising interest rates have been major headwinds for retail companies. The Consumer Discretionary Select SPDR ETF has underperformed the S&P 500 index, rising only 6% compared to the index's return of 26%. 

If you have a long-term mindset, these are the conditions that create undervalued stocks. Weak business environments send valuations down and set the stage for great returns on the rebound.

Tractor Supply (TSCO 3.26%) and RH (RH 2.28%) are above-average businesses with a history of market-beating returns for investors. Let's find out which one of these retail stocks is the better buy for long-term investors.

Tractor Supply

Tractor Supply has carved out a profitable niche serving rural America. It has 2,181 stores in 49 states, in addition to operating 192 Petsense by Tractor Supply stores in 23 states. Over the last 10 years, it grew revenue almost 12% per year, while growing earnings per share (EPS) nearly 18% annually. 

It's a strong business by any measure, but what stands out is its growth in the toughest retail environment in years. While it is experiencing some weakness that caused management to lower its full-year sales outlook, Tractor Supply still expects to report positive comparable-store sales between 1.3% to 2.5% this year. In the first half of 2023, sales and EPS grew 8% and 6%, respectively, year over year. 

Tractor Supply has been gaining market share, which positions it for a great future. Over the last three years, it invested almost $1.7 billion to improve its stores and distribution centers. 

Management recently raised its long-term growth target to 3,000 locations. Adding it up, it says its addressable market is worth $180 billion, which is why the stock could be undervalued at a forward price-to-earnings (P/E) ratio of 22. 

RH

Selling high-end furnishings can be a booming business when times are good. RH reported revenue growth of 32% in 2022 and averaged more than 11% annual growth over the last 10 years. But as inflation climbed, it became challenging to grow sales for pricey artisan-made furnishings.

Even the company's high-income customer base hasn't been much help. Sales fell 21% through the first half of the fiscal year ending July 29. That cut EPS by more than half to $5.09.

To RH's credit, it is still generating a high profit margin of 14.7% on a trailing-12-month basis. The company is still in the process of expanding its gallery footprint in large cities in North America and Europe. It's also expanding into more product categories for different living spaces (RH Beach, RH Baby, and the like) and offering design services, which should push margins higher. 

RH's focus on expensive furnishings naturally leads to higher margins when demand is strong. In the 10 years through the end of fiscal 2022, it transformed into a high-margin business, and management previously estimated the opportunity in North America alone could bring in up to $25 billion in annual revenue. That is way above its current trailing-12-month revenue of $3.1 billion.

RH stock trades at a higher forward P/E of 31, but compared to its previous peak adjusted EPS of $26.12 in fiscal 2021, the stock trades at a bargain P/E of 12.

Which is the better buy?

The key difference between these two companies is that Tractor Supply generates a substantial portion of sales from items that customers are going to buy on a monthly basis, such as livestock feed, chemicals, and pet supplies, while buying furniture is not a frequent shopping activity for most people. RH is more dependent on a strong economy, which is its biggest weakness.

This explains why Tractor Supply continued to post sales growth this year, which has allowed the stock to outperform RH. Over many years, investors are going to be better off holding shares of companies that perform relatively well in all business climates. For this reason, Tractor Supply is the better buy.