Retail giant Wal-Mart (WMT -1.75%) has long enjoyed a significant competitive advantage thanks to its massive scale. Wal-Mart is able to get the best prices from its suppliers and pass those savings onto its customers, making it next to impossible for traditional retailers to compete on price.

But the continued rise of e-commerce has changed the equation, putting Wal-Mart in a position where it's playing catch-up with Amazon.com (AMZN 1.30%). Wal-Mart has gotten far more serious about e-commerce in recent years, acquiring Jet.com in 2016 for $3.3 billion, rolling out an online grocery pick-up and delivery service, and just recently launching free two-day shipping in an effort to undercut Amazon Prime. But it remains well behind the e-commerce leader.

A couple using a self-checkout lane at a Wal-Mart supercenter.

Image source: Wal-Mart.

Wal-Mart's U.S. store business is still performing well, producing a long streak of positive comparable-sales growth thanks in part to initiatives like higher wages and better training for employees. But that business will no doubt begin to feel pressure as online sales grow as a percentage of total retail sales. Profits have taken a dive as Wal-Mart invests in e-commerce and in-store initiatives, and an earnings recovery will require these investments to pay off in the long run.

With the retail business changing rapidly, is Wal-Mart stock a safe bet? And what about the dividend? With slumping profits, is the quarterly payout at risk?

A solid dividend

Wal-Mart has not historically been a great dividend stock, in part because the stock price was soaring right along with the dividend prior to 2000. The yield was consistently below 1% until the mid-2000s, when the stock price began to stagnate. The yield has steadily risen since then, currently sitting right around 3%.

WMT Dividend Yield (TTM) Chart

WMT Dividend Yield (TTM) data by YCharts.

Wal-Mart is a Dividend Aristocrat, meaning that it has raised its dividend annually for at least 25 years. In Wal-Mart's case, the dividend has been increased annually since the very first payment in 1974. This long track record doesn't guarantee that the dividend will continue to increase going forward, but it shows that the company has been disciplined over the years in regards to capital allocation.

Wal-Mart's current quarterly dividend is $0.50 per share, with a total annual payout of $2 per share. Based on its adjusted earnings guidance for fiscal 2017, results for which the company will report on Feb. 21, the payout ratio is currently around 47%. This gives Wal-Mart some breathing room, even though earnings will be down compared to previous years.

Wal-Mart's dividend growth will likely be slow as the company diverts its resources to building out its e-commerce business. But I suspect that it will remain a dividend aristocrat for the foreseeable future.

Elevated risks

The risk of future profit declines is certainly higher today than it was before the company needed to care very much about e-commerce. Not only is there the threat of declining in-store sales as consumers shift online, but Wal-Mart is competing in e-commerce against a company that has been operating with razor-thin margins, and sometimes no margins at all, since its founding.

Amazon generates lower margins than Wal-Mart, but Amazon also spends prodigiously on everything from content for its streaming service to a $1.5 billion air hub to help shuttle around merchandise. Wal-Mart will almost certainly be more focused and disciplined with its e-commerce investments, which should help keep the bottom line intact.

The worst-case scenario for Wal-Mart would be a failure to grow e-commerce sales rapidly despite its major investments coupled with declining in-store sales. That scenario would almost certainly lead to earnings stagnation or decline, eventually putting the dividend at risk. The best-case scenario, strong e-commerce sales growth and solid store performance, would eventually lead to earnings growth.

Wal-Mart stock trades for around 16 times the company's guidance for full-year adjusted earnings. That's not bargain territory, but it does represent a discount to the overall market. Any company going through a major transition is inherently risky, but it looks like the steps Wal-Mart is taking are the right ones. Wal-Mart stock comes with risks, but not nearly as many as most other retailers.

Get the latest Wal-Mart stock news and facts.