You either evolve or you die. That's true in nature and it has been true in the retail space.

A number of once-successful companies have come upon hard times because they continued to operate as they always had. That left them open to losing customers to digital upstarts and brick-and-mortar chains that adapted to changing consumer demand.

The failures (taken together) have been called the retail apocalypse, with digital retailers (mostly Amazon.com) getting blamed for putting established chains out of business. The reality is that the chains that have struggled or died brought it upon themselves, while these four thriving companies made the moves needed to thrive and boost their stock prices for investors.

A Walmart pickup tower.

Walmart has invested heavily in omnichannel. Image source: Walmart.

1. Costco

Of the four retailers on this list, Costco (NASDAQ:COST) has had to change the least. The warehouse club has remained popular with its members and people like visiting its brick-and-mortar locations.

The retailer, however, did have to sit back, look at the market, and make some big changes. It has beefed up its website, added delivery options, and has become an omnichannel business. Costco is still a store/club first, but it has made the moves needed to serve its customers when the need for convenience trumps their desire or ability to visit a physical location.

2. Best Buy

It wasn't that long ago that obituaries were being written for Best Buy. The electronics retailer was the most high-profile victim of "showrooming." Consumers would visit the company's stores, get help from its workers, and then make their purchase online from competitors.

Best Buy turned that around by lowering prices, improving its delivery, and focusing on customers. It has also found growth by moving in the emerging healthcare technology category and building up its Geek Squad service business.

3. Walmart

Walmart (NYSE:WMT) has shown a willingness to institute changes that many large companies would never be able to accomplish. The retailer was never in any real trouble yet it made a major pivot when it purchased Jet.com and put its entrepreneurial CEO Marc Lore in charge of its overall digital business.

Lore made massive, expensive changes. He pushed the retailer into a true omnichannel model, expanded buy-online-pickup-in-store options, and moved to free two-day shipping. These moves weren't easy to pull off (and they may not have been well received by some of the chain's executives) but they have positioned the company as Amazon's closest rival.

4. Target

Target (NYSE:TGT) may have had the hardest road of any company on this list aside from Best Buy. It's big, but not Walmart big, and it has a devoted fanbase, but one that's not quite as devoted as Costco's. There was a point where it had lost its luster and no longer stood out in a crowded field.

The retailer changed that trajectory in two ways. First, it made all the right omnichannel moves, including buying Shipt to offer same-day delivery. Second, it invested heavily in creating owned-and-operated brands, some on its own and some with celebrity partners.

This has given the chain a distinct product line that its competitors can't easily duplicate. That drives traffic to its stores and website, which the company has capitalized on by extensively renovating its brick-and-mortar and digital experience.

It's about being willing to change

All of these successful retail companies have shown a willingness to make major changes. That's an encouraging thing for investors to look at because it shows that management isn't just focused on short-term results.

The retail market is ever-changing and these companies will almost certainly be well-positioned to capitalize on whatever is next. That makes these companies smart long-term choices for your portfolio because, while making changes sometimes leads to down quarters, it's essential for longer-term profitability.