Two of the biggest retailers in the world, Wal-Mart (WMT 1.02%) and Amazon.com (AMZN 1.49%), have long been engaged in a sort of David vs. Goliath battle. At one point, Wal-Mart was the Goliath as it reigned over the American retail landscape with thousands of supercenters, offering rock-bottom prices and crushing the traditional mom-and-pop businesses in towns across the country.

Over the last few years, however, those roles seem to have changed. Wal-Mart's growth has ground to a virtual halt -- last year marked the first time in generations that its revenue declined -- while Amazon is on track to top $130 billion in revenue this year, making it the biggest American retailer after Wal-Mart. 

Though Wal-Mart is still much larger based on sales and profits, Amazon's market value is nearly double that of its brick-and-mortar rival, as it's growing much faster. For investors, there's been no question as to which has been the better stock, as Amazon has delivered blockbuster returns for long-term investors.

AMZN Chart

AMZN data by YCharts.

However, Amazon's days as a stock-market juggernaut are probably over. With a market cap near $400 billion, the company seems to be stretching the limits of its valuation without dramatically increasing profits. With the prospects for both stocks shifting, let's take a look at which one would be the better buy today.

Image Source: Wal-Mart. 

Wal-Mart fights back 

Wal-Mart may have lost its retail momentum to Amazon, but the retail giant isn't standing still. Over the last two years, Wal-Mart has unveiled a number of changes, many of them in response to Amazon, to bring back customers and drive consistent sales growth.

Wal-Mart's strategy is essentially two-pronged. Instead of opening hundreds of new stores every year, the company is focused on improving its existing crop of stores and enhancing its e-commerce platform.

To improve store performance and customer satisfaction, the company raised base wages for its employees to $9/hour last year, and again to $10/hour this February. Wal-Mart has also improved training and streamlined store management to offer more promotional opportunities. The wage hikes have cost the company $2.7 billion, but they seem to be paying off, as Wal-Mart's internal store performance scores have improved by cleaning up stores and eliminating out-of-stocks, and comparable sales have increased for nine quarters in a row.

On the e-commerce front, Wal-Mart made a big splash with its $3.3 billion acquisition of Jet.com this summer, and has already rotated its former e-commerce management team out, replacing it with Jet's. The acquisition has helped Wal-Mart eliminate its cap of 8 million SKUs on its website, and it now has more than 20 million items available. E-commerce growth also accelerated to 21% in it last quarter, its fastest clip in two years. 

Looking ahead, the company will only open 55 new stores next year, the fewest since the 1990s, so it can spend the bulk of its capital expenditures on store improvements and e-commerce. Though profits are expected to fall this year, they should swing back to growth by 2018.

Image Source: Motley Fool. 

The everything empire

After dominating e-commerce, Amazon is rapidly expanding its tentacles into other areas of the business world. Its cloud-computing division, Amazon Web Services, has been wildly successful, on track to deliver more than $12 billion in revenue this year and more than $3 billion in operating income, making it more profitable than Amazon's e-commerce division.

The company has been stepping up investments in video, as it said that content expenses would nearly double in the second half of this year. It's set to release The Grand Tour with Jeremy Clarkson globally in December, and paid a reported $250 million to land the former Top Gear star and his new show.

Amazon is increasingly looking to leverage its Prime membership to launch satellite businesses. The Wall Street Journal has reported in recent weeks that the company is looking to open as many as 2,000 grocery stores as it attempts to go big with its AmazonFresh brand, and it also talked about about streaming live sports, which could either be packaged with Prime, or as an add-on. The company is also planning significant investments in India, but it only has so much money it can invest in new projects.

Amazon's growth continues to be strong as sales have increased 29% so far this year, but its profits are still thin, considering its market value. Despite the contribution from AWS, the company's P/E ratio is well into the triple digits. Going forward, Amazon will have to maintain its strong sales growth rate, but also build profits in order to satisfy investors.

Who's the winner of this retail face-off?

Amazon and Wal-Mart are vastly different stocks. Wal-Mart is a steady Dividend Aristocrat that offers a 2.8% dividend yield and the stability of a defensive stock. Amazon, on the other hand, has been one of the most volatile megacap stocks on the market. At the beginning of this year, the stock lost 30% of its value in less than two months during the market sell-off. Since then, it's gained it back, but the potential for such a correction is still there, especially with the stock's valuation still in the clouds.

Therefore, the better buy between the two probably depends on your investing style. Income-seeking, risk-averse investors will want to choose Wal-Mart, while Amazon is the better pick for growth investors. With Amazon stock approaching $800, I suspect there will be a better entry point within the next few months, but volatility should continue. As for Wal-Mart, profits may be challenged, but the company seems to be making the right investments for the long term.