Three years ago, consumer-electronics retailer Best Buy (BBY -2.19%) was in a tough spot. Former CEO Brian Dunn resigned in early 2012 amid an investigation into his personal conduct, online retailers such as Amazon.com (AMZN -1.35%) were stealing market share, and the company's e-commerce efforts were at best an afterthought. Best Buy was assumed to be going the way of Circuit City, a former competitor that went under in 2009.

Fast-forward to today, and the story has shifted dramatically. CEO Hubert Joly, who took over about three years ago, has transformed the company into a leaner, more nimble retailer. One only has to look at Best Buy's most recent earnings report to see how far the company has come: Comparable-store sales rose 3.8%, profits soared, and online sales jumped 17% year over year.

Joly and his management team still have plenty of work to do, but the turnaround at Best Buy is one of the most impressive in the history of retail.

Icons depicting stock growth superimposed over image of a businessman's hand touching laptop keys.

Image source: Getty Images.

Table stakes
When Joly took over, Best Buy's prices simply weren't competitive. The concept of showrooming, where customers browse in-store but then buy online, often getting a better price, was widely seen as an insurmountable challenge in the age of Amazon. Joly had a very simple strategy to counter it: "We believe that price competitiveness is table stakes. The way we want to win is around the advice, convenience, service.

The only way to combat showrooming is by ensuring that a better price can't be found online. Best Buy implemented a price-matching policy, both in-store and online, while also lowering its prices to be more competitive against both online retailers and discount retailers such as Wal-Mart. The result of these moves has been a contraction in the company's gross margin, which fell from 25.1% in 2010 to just 22.4% in 2014.

If this had been the only initiative Best Buy had undertaken, the company's profitability would have collapsed. But another part of Joly's plan, dubbed Renew Blue, was to drastically cut costs. By the end of 2014, Joly had removed a little over $1 billion of costs from the company. Layers of management were removed, processes were streamlined, and the supply chain was made more efficient.

It's important to understand that Best Buy didn't simply cut costs across the board. Circuit City, in the lead-up to its bankruptcy, slashed costs and fired scores of employees in an effort to remain profitable. These cost cuts backfired, as the lack of experienced store employees took a major toll on sales and the customer experience.

Despite the more than $1 billion of costs taken out of the business, Joly stated in Best Buy's most recent conference call that the amount of customer-facing labor has increased. The company's rounds of layoffs have mostly targeted middle managers and staff at the company's headquarters, an approach that ensures that the customer experience doesn't take a hit for the sake of cutting costs.

These cost cuts largely haven't flowed through to the bottom line, as Best Buy has taken the savings and invested them in various initiatives. Cutting prices is one of those initiatives, and increased employee training is another. But e-commerce may be the most important.

Competing with Amazon
Amazon operates a network of online order fulfillment centers that no other retailer can rival. Best Buy runs 23 distribution centers in the United States, but most of them are dedicated to feeding its stores, not fulfilling online orders. This difference created a major problem for Best Buy: An item had to be in stock at a distribution center set up for online fulfillment for a customer to be able to buy it online.

Best Buy's online conversion rate was downright awful in 2013. In that year, 1 billion website visits translated into just $2.3 billion of sales. A website redesign 2013 helped the cause, but product availability was still an issue.

Best Buy's solution was the implementation of a ship-from-store initiative, with which its 1,000-plus retail stores act as mini-distribution centers, with store employees packing and shipping online orders. This approach isn't as efficient as Amazon's giant fulfillment centers filled with robots, but Best Buy's plan used its current assets, turning its network of stores into an advantage.

This program accomplished two things. First, it opened up store inventory to the online channel, vastly increasing product availability on the website, including clearance items and returns that would have previously been stuck at an individual store. Second, it reduced shipping times substantially. According to StellaService, in October 2013, after many of Best Buy's stores had begun shipping online orders, the company's average shipping time was faster than that of Amazon.

One thing working in Best Buy's favor is that Amazon collects sales tax in more states. For years, Amazon had a built-in price advantage over national retail chains, since it didn't collect sales tax in states where it had no physical presence. Joly stated during Best Buy's most recent conference call that 89% of the U.S. population now lives in states where Amazon collects sales tax, up from less than 50% three years ago.

Why Best Buy is succeeding
Best Buy provides a service that an online-only retailer can't match: the ability to see, touch, and try a product in person. That's extremely important for the large swath of the population that isn't particularly tech savvy. Combine this advantage with prices that are competitive with online retailers, and customer service that's superior to discount chains such as Wal-Mart, and you have the recipe for Best Buy's long-term success.

Best Buy has come a long way over the past three years. The company is winning market share, growing sales even as NPD reports industrywide declines in consumer-electronics sales. Its e-commerce efforts are bearing fruit, and a renewed focus on selling appliances is helping to drive in-store sales growth. During the latest quarter, comparable-appliance sales jumped by more than 20%, now accounting for 10% of Best Buy's sales.

There's plenty of work left to do, and plenty of additional costs to wring out of the company. But Best Buy, just three years ago on a path that would have probably led to its demise, is now a force to be reckoned with.