Source: Best Buy.

Electronics retailer Best Buy (BBY -0.39%) has faced a number of challenges in recent years. First is the deflationary price environment in product categories such as televisions, where prices have declined significantly in the past few years. In addition, the uneven recovery in the U.S. economy has restrained many consumers' ability to spend on personal electronics.

But perhaps the biggest threat to Best Buy was what some call the "showrooming" effect, a trend in which consumers were supposedly entering Best Buy stores to see products on shelves and ask questions to staff, only to return home to purchase those items cheaper online. This trend has caused Best Buy stock to swing wildly over the past few years, falling from $45 to $11 from 2011 to 2012, and then surging back to $40 by 2013, before settling at its current level near $30.

Best Buy surged another 14% on Aug. 25, after reporting better-than-expected quarterly earnings. Here's how Best Buy has rejuvenated its business and beat the feared showrooming effect once and for all.

Online, smartphones provide a boost
Best Buy reported $0.49 per share of earnings on $8.5 billion of revenue, good for 17% year-over-year earnings growth and 1% sales growth. More importantly, Best Buy's comparable sales, which measures sales at locations open at least one year, rose 2.7%, much better than analyst expectations of 1%, according to estimates from Thomson Reuters.

Best Buy has seen a dramatic reversal in its business. Comparable sales in the U.S., its most important market, rose 3.8% last quarter, compared with a 2% decline in the same quarter last year.

One reason for Best Buy's success is its high-growth e-commerce business. Best Buy has heavily invested in building its mobile and online presence in recent years, and that investment is paying off. Comparable sales online jumped 17% last quarter, as Best Buy benefited from increases in both traffic and conversion rates.

The other major benefit for Best Buy last quarter was growth in appliances and mobile phones. Growth in mobile phones was driven primarily by higher prices, thanks to new product releases in recent months. Overall, strong results in these categories drove 3.9% growth in total domestic revenue for the quarter.

Future focus could pay off
Going forward, Best Buy is betting big on smartwatches, particularly on the Apple Watch. Best Buy announced on its conference call that beginning Sept. 4, it will be carrying the Apple Watch in more than 900 of its big-box stores. By the end of September, it will be available in all big-box stores and in 30 Best Buy Mobile stores.

Best Buy will also feature the Apple Watch more prominently in its stores, because of exceptional demand, according to the CEO.

If smartwatches, including the Apple Watch, prove successful, it should help Best Buy counteract the showrooming effect even more going forward. Since smartwatches are relatively new devices that remain largely unfamiliar, it's likely consumers will appreciate being able to see and touch the product in store and ask questions to staff members before making such a big purchase.

Best Buy on firmer ground
Because of Best Buy's consistent profitability, the company can afford to return a lot of cash to shareholders. Just last quarter, Best Buy returned $321 million to shareholders in share buybacks and another $81 million in dividends. Best Buy pays a 3% dividend at recent share prices.

The company expects fiscal 2016 to be another successful year, which will keep its cash return program alive and well. In March, Best Buy announced a $1 billion share repurchase program, to be conducted over a three-year period.

Such a large share buyback will provide a tailwind to earnings-per-share growth going forward. If Best Buy can continue to grow same-store sales, which is likely as a result of new products in smartphones and watches, as well as its e-commerce business, the company stands a good chance of beating expectations in future quarters.