Consumer electronics retailer Best Buy (BBY -0.55%) didn't have the best holiday quarter. Comparable sales dropped 0.7%, even with a 17.5% rise in online sales. The company missed analyst estimates for revenue, and the stock promptly -- and temporarily -- took a dive.

Despite weak sales, there was still a lot to like about Best Buy's quarter. Earnings surged, with non-GAAP earnings per share (EPS) soaring 27% and GAAP EPS jumping 37%. Domestic online revenue was $2.3 billion, with increased traffic and higher conversion rates driving growth. Online sales accounted for 18.6% of Best Buy's domestic revenue during the fourth quarter, up 3 percentage points year over year.

While the simplest course of action would be to write off Best Buy as just another big-box retailer struggling with falling sales, I think that would be a mistake. Best Buy is one of the best deals in retail, and the stock is even cheaper than it looks.

A Best Buy storefront with a crowd of people waiting to enter.

Image source: Best Buy.

Putting lower sales in context

Best Buy's comparable-sales decline during the fourth quarter was disappointing for sure. But the company is facing some headwinds that are out of its control. A lack of exciting new products is one problem – NPD estimates that total consumer electronics industry revenue slumped 2.8% year over year during the fourth quarter. This suggests that Best Buy is winning market share in a difficult market.

Best Buy also blamed a couple of specific factors for its fourth-quarter performance. Demand for gaming products was considerably weaker than expected, and unprecedented merchandise availability issues across multiple vendors and categories hurt sales. Best Buy had previously warned about potential negative effects related to product recalls, most notably the Samsung Note 7.

Every company that suffers a setback will happily blame a set of issues out of its control. It's the job of investors to determine whether those reasons are legitimate, or mere excuses. With retailers competing for foot traffic as consumers are increasingly moving online, a highly promotional environment knocked down sales and profits at many retailers during the fourth quarter. Without further inspection, it would appear that Best Buy suffered the same fate.

But Best Buy managed to grow its gross margin significantly compared to the fourth quarter of 2015. Gross margin came in at 22.5%, up 80 basis points year over year. This suggests that Best Buy wasn't forced to boost its promotional activity in response to competition, allowing its profits to surge even as sales slumped. All things considered, Best Buy performed well during the fourth quarter.

Cheaper than it looks

Best Buy produced non-GAAP EPS of $3.56 in fiscal 2017, putting the price-to-earnings (P/E) ratio at about 12.5. With Best Buy calling for flat revenue and operating profit this year on a comparable basis, that valuation doesn't seem overly cheap or overly expensive. But Best Buy's fortress balance sheet skews its valuation metrics. The stock is actually quite a bit cheaper than it appears.

At the end of fiscal 2017, Best Buy had $3.92 billion of cash and investments and $1.37 billion of debt on its balance sheet, good for a net cash position of $2.55 billion. Net cash represents nearly 20% of the company's market capitalization. If this net cash is backed out, the cash-adjusted P/E ratio falls to just 10.

This cash, along with plenty of free cash flow, also allows Best Buy to fund a generous dividend and a substantial share buyback program. The company announced a 21% dividend increase along with its fourth-quarter results, boosting the dividend yield up to 3.05%. The payout ratio is still just 38%, leaving plenty of room for future increases. A new $3 billion share buyback program was also announced, which will create plenty of value for shareholders at the current stock price.

Best Buy has shown that's it's a survivor. The company has aggressively invested in its online business, and it's managed to grow both gross margin and overall profit despite industry headwinds. As smaller chains like RadioShack and hhgregg fold, Best Buy is winning market share and successfully going toe-to-toe with Amazon. Earnings growth may be tougher to come by going forward, but the valuation looks overly pessimistic to me.