The retail industry is going through a major disruption, with e-commerce reaching critical mass and forcing even the most successful brick-and-mortar retailers to adapt. Already we've seen some bankruptcies, including RadioShack, hhgregg, and Sports Authority, and companies like Sears Holdings are knocking on death's door. Buying retail stocks amid this carnage is a delicate task, to say the least.

There are a few retailers, however, that have bucked the trend. Wal-Mart Stores (WMT -1.75%) is investing in both its stores and e-commerce, driving growth across the board. Best Buy (BBY -0.11%) is getting more efficient, slashing costs and delivering impressive profit growth. And Home Depot (HD 0.86%) is proving that its business is about as Amazon-proof as it gets. Here's why these three retailers are the top picks for 2017.

A retail juggernaut

Wal-Mart dominated the era of big-box discount stores, driving countless competitors out of business with its low prices. Amazon is now dominating the era of e-commerce, at least so far, putting every brick-and-mortar retailer at risk. Competing with Amazon will be neither easy nor cheap, but Wal-Mart is finally taking the threat seriously.

Two people checking out at a Wal-Mart store.

Image source: Wal-Mart.

Wal-Mart's stores are, somewhat surprisingly, doing just fine in the age of e-commerce. Comparable-store sales have risen in the U.S. each quarter for the past few years, driven in part by investments the company has made in its stores, including higher wages and better training for employees. While other retailers were struggling to attract customers during the holiday quarter, Wal-Mart managed a 1.8% increase in U.S. comparable sales, driven almost entirely by an increase in traffic.

The stores also provide a platform for Wal-Mart's online grocery pickup service, where customers order online and pick up for free at a store, with delivery available for an additional fee. This service, along with Wal-Mart's acquisition of Jet.com last year, led to a 29% increase in online sales during the fourth quarter. Going forward, the recent move to offer free two-day shipping for all orders above $35, which dealt a blow to the value proposition offered by Amazon Prime, should help Wal-Mart maintain its e-commerce momentum.

All of these investments are taking a toll on the bottom line. Wal-Mart expects to produce EPS between $4.20 and $4.40 this year, down at the midpoint compared to last year and substantially below peak earnings in 2014. But the cost of ignoring the threat posed by Amazon would be far higher in the long run. After dominating traditional discount retailing for decades, Wal-Mart is positioning itself to be a major force in e-commerce as well.

Surviving and thriving

Since 2012, Best Buy has staged an impressive turnaround. Unnecessary costs were slashed, with layers of management removed and efficiencies wrung out of the supply chain. Investments in e-commerce have led to booming online sales, driven by both increased web traffic and higher conversion rates. U.S. online sales jumped 17.5% year over year during the fourth quarter, with a larger 20.8% gain registered for the full year.

Most importantly for investors, profits have soared. Adjusted EPS surged 28% during 2016 on a slight decline in total sales, driven by a higher gross margin and lower operating costs. Best Buy has become more competitive on price during its turnaround, but its gross margin is now not too far below historical levels. At the same time, the company has become far more efficient, spending just 19.2% of revenue on operating costs in 2016. That compares to 20.5% in 2010.

Further earnings growth will be tougher to achieve, as there is a limit to Best Buy's cost-cutting efforts. Results last year were hurt by product availability issues, recalls like that of the Samsung Galaxy Note 7, and a general lack of exciting new products, but Best Buy still managed to drive earnings higher. Trading at just 10 times earnings after backing out the net cash on the balance sheet, Best Buy is one of the best deals in retail.

Amazon-proof

While some retailers have done better than others in the age of Amazon, Home Depot is firing on all cylinders. Revenue has grown consistently since 2009, jumping 6.9% in 2016 largely thanks to a 5.6% increase in comparable sales. Home Depot's operating margin last year was an impressive 14.2%, nearly double its operating margin in 2009. Based on this performance, it should be no surprise that the stock has nearly tripled over the past five years.

HD Chart

HD data by YCharts.

Selling large appliances, power tools, fixtures, outdoor furniture, lumber, and other products that don't translate well online, Home Depot has been able put up record numbers despite the ongoing consumer shift toward e-commerce. Home Depot isn't ignoring e-commerce, with online sales jumping 19% in 2016 and representing 5.9% of total revenue. But its stores are driving a big part of that growth, with 45% of all online orders being picked up by customers.

Home Depot's stellar performance doesn't come cheap for investors. The stock trades for about 23 times earnings, a lofty valuation for a retailer with nearly $100 billion in annual sales. Still, the company's record over the past few years, and its potential to grow earnings going forward, may be enough to justify the price tag. Home Depot certainly isn't a stock for bargain hunters, but it is a good choice for those wanting to invest in one of the best retailers around.