Assessing which retail stocks to hold for the next 10 years is a daunting task. After all, no one knows what the economy will do in the interim, and the sector is littered with failed companies.

But there are long-term winners that you can invest in. These are two companies that provide value to their customers, consistently improve sales and earnings, and reward shareholders with higher dividends.

A hand holding a clock and coins alongside a bag of coins.

Image source: Getty Images.

1. Costco

Costco's (NASDAQ:COST) shareholders enjoyed a rewarding year.  The top line was strong during fiscal 2020 (ended Aug. 30) with same-store sales (comps) increasing by 9% when excluding foreign currency exchange translations and changes in gasoline prices. The higher sales translated into growing profitability, with operating income 15% higher to $5.4 billion.

While COVID-19 helped Costco's performance -- since it remained open while governments forced others to shut their doors -- this wasn't entirely driven by increased buying due to the virus. In fact, the company has a long history of comps increases, and operating profit has grown by nearly 50% over the last five years.

It's been successful for so many years by offering members a wide variety of high-quality goods and services at attractive prices. With the number of paid members growing year after year, including a jump from 47.6 million to 58.1 million over the last five years, more people find its proposition appealing. Meanwhile, Costco's members stay on board, with 91% of U.S. and Canadian customers renewing their membership. Adding new members and retaining existing ones bode well for future sales and earnings.

The company's earnings growth has led to a lot of cash coming in. It has used part of this to increase dividends for years, including raising them by 8% in May to $0.70. While the dividend yield is 0.7%, it has also pleasantly surprised shareholders by declaring large special dividends every few years. That includes this month's $10 payment.

2. Walmart

Walmart's (NYSE:WMT) stockholders are also looking back fondly on 2020, with a 21% price gain that crushed the S&P 500's 14% increase. Although the U.S. government deeming it a critical retailer earlier this year helped short-term results, this is more than merely the pandemic boosting sales. The company's low-priced offerings, which have led it to become the world's largest retailer, drove customers to its store and website.

Its fiscal third-quarter (ended on Oct. 31) adjusted revenue rose by 6.1% to $135.8 billion, and operating income was up by more than 16%.

Since opening its first discount store nearly six decades ago, Walmart has a long history of keeping costs down so that it can offer ultra-low prices to its customers. It's clearly succeeding, with 265 million people buying goods from its stores and websites every week.

Management's push into digital initiatives is working, too. The omnichannel approach sets the company up for long-term success by allowing customers to shop the way that they want. In the latest period, Walmart's U.S. comps rose by 6.4% with 90% of the increase coming from e-commerce sales.

As part of this strategy, it launched Walmart+, its subscription offering that charges members $98 a year, in September. For that amount, members receive free delivery, a smoother checkout process, and discounts on gas.

While these steps will allow Walmart to keep up with competitors,  particularly the formidable Amazon (NASDAQ:AMZN), Walmart also has a strong track record of growing dividends each year, hiking the payments since making its first one in 1974. The stock yields 1.5%.

Each company is executing very well on its strategy and producing results, and that will undoubtedly continue in various economic climates. Granted, there are companies growing faster than Costco and Walmart, but the steady approach in the marathon wins the race.

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.