Source: Best Buy.

Best Buy (BBY -0.11%) stock has declined by nearly 18% year to date as the company faces considerable challenges at adapting to the online retail revolution and the huge competitive threat represented by players such as Amazon (AMZN 1.30%).

On the other hand, Best Buy delivered better than expected earnings for the second quarter of fiscal 2015 on Tuesday, and the stock has rebounded by more than 22% over the last six months as investors seem to be gaining confidence in the company's chances of implementing a successful turnaround.

Is Best Buy stock a buying opportunity for investors, or is it better to stay away from the company until it proves it can successfully reverse the declining sales trend?

Falling sales, growing earnings
Best Buy announced a worrisome decline in sales of 4% during the second quarter of fiscal 2015, to $8.9 billion versus $9.3 billion in the same period last year. Sales in the domestic market declined 2.4% to $7.59 billion on the back of a 2% decline in domestic same-store sales.

Domestic online revenue increased by a big 22% to $581 million, and this was one of the main positives in the report. However, the online channel still represents only 7.6% of total domestic revenue, so the broad trend when it comes to domestic sales does not look very encouraging at all.

Things are not looking much better in international markets, where total sales declined 12.1% to $1.31 billion during the last quarter. Same-store sales in international markets fell 6.7%.

Gross margin declined to 23.1% of sales versus 26.5% of revenue in the same quarter last year. However, management is doing a sound job at reducing costs; SGA expenses declined 11% to $1.8 billion versus more than $2 billion in the same period in 2013. As a percentage of sales, SG&A expenses declined to 20.4% of revenue from 22% in the year ago quarter.

Cost discipline allowed Best Buy to deliver better than expected earnings during the quarter. Adjusted earnings per share came in at $0.44, an increase of 37.5% versus $0.32 per share in the same quarter last year, and considerably better than the $0.31 per share forecasted on average by Wall Street analysts polled by Thomson Reuters.

A questionable future
Management is expecting comparable sales to continue declining in the low-single digits during both the third and fourth quarters of the year. The company attributes this weakness to two main causes: Shifting consumer habits as customers are increasingly searching and buying online, and weak industry sales because of factors such as softness in the mobile phone category.

Many bricks-and-mortar retailers in the electronics category have been going through considerable difficulties lately. The industry is particularly prone to showrooming, meaning when customers compare products at physical stores only to end up buying those products online for a conveniently low price and home delivery.

Besides, pricing is a big competitive factor in the category, and Amazon is a dreaded competitor when it comes to pricing. The online retail king benefits from a gigantic scale, an efficient cost structure, and the competitive drive to sell products for minuscule profit margins. It's no wonder Amazon is clearly gaining market share versus traditional retailers in the category.

Amazon announced an explosive growth rate of 29% in sales of electronics and other general merchandise products in North America during the second quarter of 2014, reaching $8.37 billion during the period. During Cyber Monday last year, Amazon reported that customers around the world bought more than 36.8 million items; this means an amazing figure of 426 items per second.

Online is the name of the game in electronics retail lately, and Best Buy is fighting an uphill battle in that segment versus a tremendously powerful juggernaut such as Amazon. Unless there is any material change in the competitive dynamics in the industry, there is no reason to expect Best Buy to reverse the declining sales trend anytime soon.

Key takeaway
It's good to see Best Buy keeping costs under control and expanding its online presence. However, overall sales are still declining significantly, and cost-cutting can only go so far when it comes to improving profit margins in this context. Unless Best Buy proves it has a successful and sustainable strategy to generate sales growth, the stock is a considerably risky investment.