In the past five years, the disruptive impact of Amazon.com's (AMZN 1.30%) growth has moved well beyond bookstores and consumer electronics chains. Even categories like apparel and groceries that were once thought to be Amazon-proof are proving to be fertile ground for the e-commerce giant.

The result has been a stampede by investors out of retail stocks. Yet some parts of the current retail landscape still seem Amazon-proof. A handful of best-in-class companies continue to expand at a healthy pace while keeping their profit margins relatively stable.

Off-price retail is one bright spot. Ross Stores (ROST -0.51%) and TJX Companies (TJX 0.45%) have been able to keep growing comparable store sales -- a key revenue metric that strips out the impact of opening and closing stores -- by reacting quickly to fashion trends and offering a treasure-hunt experience in their conveniently located stores. Savvy consumers can often find better deals at a Ross Dress for Less or T.J. Maxx store than on Amazon.com.

Discount warehouse club leader Costco Wholesale (COST 1.01%) has also demonstrated that it can coexist profitably with Amazon. After a brief rough patch, it is back to posting strong comp sales growth, thanks to the rock-bottom prices it offers in its warehouses.

The front entrance of a Costco warehouse.

Costco's low prices have been a potent tool for fending off Amazon. Image source: Costco Wholesale.

Shares of Ross Stores, TJX, and Costco are pricier than those of their more vulnerable rivals. However, despite holding premium valuations, all three stocks are well-positioned to continue making gains.

Ross Stores is an unstoppable force

Among all large-cap brick-and-mortar retailers, Ross Stores arguably has the most momentum in its business. The company has a virtually unrivaled record of steady comp sales increases, averaging about 4% annual comp sales growth over the past five years. Ross Stores is on pace for a similar comparable store sales increase this fiscal year.

Meanwhile, Ross Stores has been building on its already enviable profit margin. Last year, the company posted a record operating margin of 14%, up from 13.6% a year earlier. Based on its performance through the first nine months of fiscal year 2018, Ross Stores' operating margin is set to reach another record this year.

The result is an admirable track record of double-digit earnings growth. Year to date, Ross Stores has reported a 15% rise in earnings per share -- and that's been a fairly typical growth rate recently. It has done this without even bothering to operate an e-commerce website.

Skeptics believe that Amazon will eventually start to eat away at Ross Stores' business. Yet off-price retailers have significant advantages over department stores and even big-box discounters. First, they operate small, bare-bones stores that are cheap to build and easy to navigate. Second, off-price chains typically place their stores on heavily traveled roads, so that it is convenient for customers to stop by frequently. Third, they offer an exciting shopping experience because the merchandise changes constantly. And most importantly, off-price retailers' opportunistic buying strategies allow them to offer bigger bargains than Amazon most of the time.

If Ross Stores' business remains healthy, the company will have plenty of room to grow. It estimates that it could eventually operate 2,500 stores in the U.S., up from 1,627 stores today. Even that may be a conservative estimate, as Ross Stores has yet to expand to much of the Northeast and Midwest.

The exterior of a Ross Dress for Less store.

Ross Stores has plenty of room for growth. Image source: Ross Stores.

Ross Stores stock trades for a little more than 20 times forward earnings: a modest premium to the broader market. Given that Ross Stores could continue to grow EPS at a double-digit rate for another decade or more, this is a very reasonable valuation. Furthermore, Ross Stores pays the full statutory tax rate today, so EPS could rocket higher if Congress passes a tax reform bill.

TJX makes the cut despite a recent setback

Off-price giant TJX has many of the same competitive advantages as Ross Stores. Its stores tend to be conveniently located in strip malls on busy streets, and TJX has buyers stationed across the world to find the best deals on exciting merchandise. This powerful business model has allowed TJX to grow its revenue from around $7.5 billion to nearly $35 billion over the past two decades.

For most of the past five years, TJX has posted strong comparable store sales growth, including 5% increases in each of the past two fiscal years. That said, its growth has stalled this year.

In the first half of fiscal year 2018, comp sales growth slowed to 2% on a companywide basis. Moreover, TJX recently reported flat comp sales for Q3, including a 1% decline in the "Marmaxx" segment, which consists of the T.J. Maxx and Marshalls chains in the U.S. and accounts for roughly 60% of the company's revenue.

While TJX's third-quarter revenue results were disappointing, they reflect the dampening effect of unseasonable weather during September and early October, as well as the impact of several major hurricanes that disrupted operations during the quarter. A few fashion missteps (which are already being corrected) also hurt TJX's performance.

On the bright side, adjusted EPS jumped 10% last quarter, due to the strength of TJX's Canadian operations and its HomeGoods chain in the United States. Furthermore, the stock trades for just 17 times forward earnings as investors have started to wonder whether TJX has already peaked.

However, TJX's subpar year-to-date performance is probably a blip on the radar, given that it was posting even stronger comp sales growth than Ross Stores just a year ago. Management sees room to grow the company's store count by at least 50%, and TJX has ample room for margin expansion, especially outside of North America. This sets the stage for strong EPS growth in the future. Finally, while TJX is a global business, it still generates the vast majority of its profit in the U.S., so it would also be a big winner from tax reform.

Costco stays the course

Costco Wholesale is another impressive business that appears to be Amazon-proof. Like TJX and Ross Stores, offering even lower prices than Amazon is critical to Costco's enduring success.

Costco's prices are virtually unbeatable due to the company's low operating costs and enormous buying power. Revenue is on track to reach $137 billion in fiscal year 2018, even though Costco only carries about 4,000 SKUs (individual products) in a typical warehouse. That means the company is buying each individual item in huge quantities, giving it massive negotiating leverage with suppliers. By contrast, Amazon has surpassed Costco in terms of revenue, but it carries more than 500 million products.

Meanwhile, gross margin was just 11.3% in Costco's recently ended 2017 fiscal year. Costco can afford to operate on such thin margins because it has rock-bottom operating costs (due to its high-volume business model) and generates the bulk of its profit from membership fees.

A year or two ago, it seemed like Costco Wholesale was finally losing steam as sales and profit growth slowed. However, comp sales growth accelerated again in the second half of fiscal year 2017. This momentum has continued into fiscal year 2018, with comp sales up 6% through the first two months of the fiscal year (excluding the impact of gas prices and foreign currency fluctuations).

Meanwhile, profit growth has also bounced back, thanks to the favorable economics of Costco's new domestic credit card partnership with Citi and a recent membership fee increase. The fee increase will have an even bigger impact on profit growth over the next several quarters. As a result, Costco is back to posting double-digit EPS growth.

Costco stock certainly isn't cheap: It trades for 27 times the company's estimated EPS for fiscal year 2018. That said, the company has a virtually endless runway for growth. It is increasing its square footage about 3% to 4% annually, with the vast majority of its growth in the relatively mature U.S. and Canada markets. Costco also operates in nine other countries, but it is just scratching the surface of its potential outside the U.S. and Canada.

With its purchasing power and low operating costs forming a giant moat, Costco Wholesale could be the ultimate Amazon-proof retailer. There could be decades of steady growth ahead for Costco as it fills in the remaining white spaces in North America and expands abroad.