The traditional retail world has been slowly imploding in the face of online competition led by Amazon (AMZN -1.64%).

Costco (COST 0.17%), however, has been somewhat immune to the factors hurting other physical retailers. In fact, the warehouse club actually has the two attributes that have proven valuable in getting customers to visit its stores instead of buying online: It offers strong value and it's a destination.

Consumers pay their $55 annual membership fee to shop at Costco partly to save money. The chain's warehouses offer a limited selection of items generally sold in bulk at good prices. It also has a rotating selection of deals and merchandise (as well as free samples) that make it fun to visit. That experience is something e-commerce sites can't match.

While the rise of e-commerce threatens all physical retailers, it's not currently hurting Costco. That, plus the company's enduring record of success, its dividend, and its member loyalty make it a sensible stock buy at a time when most companies in its sector offer a lot of risk.

Costco may not be an exciting play, but it's a steady one. Image source: author.

Costco's sales are strong

The warehouse club chain has not been posting massive same-store sales growth, but it has managed to nudge numbers higher when you factor out the impact of lower gas prices and foreign exchange headwinds. In the United States, comparable-store sales closed fiscal 2016 3% higher, Canadian sales grew 8%, the rest of the chain's international operations were up 4%, and the entire company was up 4%

Overall net sales grew 2% for the year to $116.07 billion from $113.67 billion last year. Net income dropped slightly from $2.38 billion, or $5.37 per diluted share in 2015, to $2.35 billion, or $5.33 per diluted share this year.

These workmanlike results suggest that Costco may not have explosive growth ahead of it, but you wouldn't expect that from a mature company anyway. Instead, Costco has shown that in the face of ever-increasing online competition, and an Amazon that's continually improving its delivery, it can still hold its own.

Membership has stayed steady

Costco makes most of its profit -- about 75% -- from membership fees. That means the chain can actually maintain most of its profits even if people visit its warehouse clubs less often, as long as they still see the value of renewing their memberships.

The company has done a good job holding onto to its members while adding new ones. CFO Richard Galanti explained the membership numbers, breaking down the various categories, in the company's Q4 earnings call, which was transcribed by Seeking Alpha (registration required).

In terms of number of members at fourth quarter and year end, at year end, we had 36.8 million Gold Star members, up from 36.2 million 16 weeks earlier at the end of the third quarter. Primary Business ticked up to 7.3 million from 7.2 million. Business add-on remained at 3.5 million for a total of 47.6 million member households at Q4 end compared to 16 weeks earlier when it was 46.9 million.

When you factor in families and businesses with multiple cardholders, there were 86.7 million people carrying Costco membership cards at the end of the chain's fiscal 2016. That's up from 85.5 million at the close of fiscal 2015.

Costco has been a fairly steady gainer for a decade. Image source: YCharts.com.

Costco is a buy

The warehouse club has shown it can deliver a mix of value and experience that will attract people to its stores despite online competition. It's also worth noting that the chain offers a number of services -- gas stations, eye exams, hearing aids, and pharmacy services to name a few -- that can't be easily duplicated by Amazon or other digital retailers. That gives it an added level of protection against losing business to online rivals, and offers another reason for members to renew.

It's actually possible that Costco will benefit from the retail crisis being caused by the e-commerce boom. If a big retailer like Sears goes out of business Costco could pick up some of its customers.

Costco's shares don't have the same massive upside potential as those of Amazon or other dynamic digital retailers. However, the stock is a steady gainer that pays a dividend ($0.45 for each of the last three quarters).

Costco may eventually lose some business to the internet, but there are no signs it will happen anytime soon. The warehouse club, in both its stores and its stock, offers good value. And that can help customers and shareholders with their personal bottom lines.