In case you somehow missed the news, shares of Amazon.com (NASDAQ:AMZN) crossed the $1,000 barrier last week, beating out Alphabet in the race to that psychologically powerful accomplishment. The e-commerce giant's market capitalization is now approaching half a trillion dollars, despite a long history of scant profitability. The stock has quadrupled since the beginning of 2013, with investors enamored of not only the retail business, but the fast-growing cloud computing business as well.

For investors who have avoided Amazon, put off by its valuation, that massive gain is a missed opportunity. But I have some good news. You don't need to buy high-flying stocks like Amazon to achieve outstanding returns. If you feel uncomfortable paying hundreds of times earnings for a stock, don't. Instead, look for stocks that have been cast away, beaten down by pessimism. Among those, you're sure to find a winner.

Case in point: Best Buy (NYSE:BBY). Amazon stock may have quadrupled over the past four and a half years, but Best Buy stock has performed even better. Shares of the consumer electronics retailer have quintupled in that time, beating out Amazon by 100 percentage points. That's right: Lowly old Best Buy, a company that many thought would be killed by Amazon, has been a better investment than the retail-slayer itself.

AMZN Chart

AMZN data by YCharts.

How did this happen? It was a simple case of severely depressed expectations, a valuation that baked in the worst-case scenario, and an eventual change in narrative.

Priced for failure

The narrative in 2012 was that Best Buy was in trouble. With prices often higher than consumers could find online, the practice of showrooming, where a customer browses in-store only to place an order at a competing retailer online, was viewed as an existential threat. Internally, Best Buy was going through an upheaval. Revenue and margins were contracting, and former CEO Brian Dunn was forced out after an inappropriate relationship with an employee was discovered.

The stock tanked in 2012, losing 50% of its value and closing out the year below $12 per share. Articles discussing whether bankruptcy was on the table started to appear. The company brought on a new CEO, Hubert Joly, in August of 2012, but investors initially saw no reason to change course. This was peak pessimism for Best Buy.

Richard Schulze and Hubert Joly

Best Buy founder Richard Schulze and CEO Hubert Joly. Image source: Best Buy.

That pessimism planted the seeds of a five-bagger. While Best Buy certainly had some issues, and its long-term survival required a rethinking, the stock was so cheap that almost any outcome other than bankruptcy would have led to good returns.

Best Buy's market capitalization bottomed out around $4 billion. In 2012 the company produced sales of $49.6 billion, adjusted net income of $889 million, and $965 million of free cash flow. All were in decline, but a valuation of four times free cash flow is pretty pessimistic. What's more, the balance sheet following the holiday season was solid enough. Cash totaled $1.83 billion, with debt of around $1.75 billion.

Fears of a bankruptcy in the near term were clearly unfounded. For Best Buy stock to recover, the company didn't need to hit a home run, given the valuation; it just needed to stop the bleeding. But Joly stepped up to the plate swinging for the fences, and he delivered in a big way. The company implemented a price-matching policy, embracing showrooming instead of trying to fight it. It slashed unnecessary costs while investing more in its stores.

Best Buy went all in on e-commerce, aiming to fix an abysmal online conversion rate that was hampering its sales. The company redesigned its website in 2013 and began shipping orders directly from its more than 1,000 stores, which helped boost sales and slash average shipping times. Free shipping is now offered on any order above $35, with free two-day shipping available for thousands of items. That minimum is routinely waived during the holidays, helping the company lure shoppers who would otherwise buy from Amazon.

The results speak for themselves. In 2016 Best Buy produced $1.15 billion of adjusted net income and $1.96 billion of free cash flow. The balance sheet featured $3.9 billion of cash and just $1.4 billion of debt. That $4 billion valuation looks comical in retrospect. The narrative has changed as well. A Barron's article in May called Best Buy one of a handful of retail survivors, along with the likes of Costco, Home Depot, and Wal-Mart. Such a statement would have sounded crazy in 2012.

With the market at all-time highs, there's no shortage of expensive stocks that have provided fantastic returns over the past several years. But few stocks have performed better than Best Buy, a clear case of value investing working its magic. Searching for the next Best Buy, instead of the next Amazon, may be the simplest path to exceptional returns.

Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. Timothy Green owns shares of Best Buy. The Motley Fool owns shares of and recommends Alphabet (A shares), Alphabet (C shares), Amazon, and Costco Wholesale. The Motley Fool recommends Home Depot. The Motley Fool has a disclosure policy.