Source: Amazon.com

Amazon (NASDAQ:AMZN) and Wal-Mart (NYSE:WMT) have been going down very different paths over the last decade. Amazon's market capitalization is booming, while Wal-Mart's has been stagnant or even declining in the last several years.

In a sign of the times, Amazon surpassed Wal-Mart in market capitalization in 2015. The online retailer is now worth over $263 billion, versus $190 billion in market value for Wal-Mart. Should Amazon really be worth almost 40% more than Wal-Mart, or are investors overreacting?

AMZN Market Cap data by YCharts

On market capitalization and investor sentiment
To be fair, market capitalization is not necessarily the only, or even the best, metric to analyze a company. Stock prices can be quite volatile over time, and they depend not only on a company's fundamental performance but also on investors' opinions and sentiments about the future of a particular business.

Wal-Mart is forecasted to produce a gargantuan $485.6 billion in revenue during the fiscal year ending on January 2016, while Amazon is expected to make nearly $106 billion in total sales in 2015. This shows that investors are willing to pay much more for every dollar of revenue from Amazon than from Wal-Mart. When looking at sales over a trailing twelve months period, Amazon stock trades at a price-to-sales ratio of 2.7 versus only 0.4 for Wal-Mart.

Investors are clearly much more optimistic about Amazon than Wal-Mart, and there are many good reasons to believe that Amazon has far better prospects than Wal-Mart; however, there is always the possibility of a market overreaction when it comes to stock prices and market capitalization.

That being said, the two companies are very dissimilar when it comes to sales growth trajectory and future potential, and this changes everything when deciding how much you should pay for every dollar of revenue.

Amazon is truly on fire
Amazon's rise over the last decade has been hard to miss. In 2005 the company was just an online bookstore that made only $511,000 in total sales. Fast forward ten years, and Amazon is the undisputed king in online retail and a leading player in cloud computing. The company is expected to make $106 billion in revenue during 2015.

And there's no slowdown at sight: sales during the second quarter of 2015 grew by a staggering 20% to $23.2 billion, while sales in constant currency increased by an even bigger 27% from the same quarter last year. Worldwide unit growth was 22%, and the company has a gigantic user base, with 285 million active accounts around the world.

Amazon keeps strengthening its competitive position in online retail, with big investments in technology, logistics, and infrastructure. In addition, its Amazon Web Services cloud computing division produced $1.82 billion in revenue during the second quarter, a staggering 81% growth rate from $1 billion in the second quarter of 2014.

Wal-Mart: The sleeping giant
Wal-Mart is a very different story. With over 11,500 stores globally and operating in a mature industry, it's not easy for the company to find new growth venues. Adding insult to injury, Amazon and other online players are clearly taking market share away from brick-and-mortar retailers.

Total revenue grew by an uninspiring 0.1% last quarter, while sales in constant currency did considerably better, increasing 3.6%. Making things worse, management recently announced a big reduction in earnings guidance, not only for the current year, but also for fiscal year 2017.

The company is feeling the pressure from increased salaries and growing investments in e-commerce, and while these initiatives seem well intended in terms of positioning Wal-Mart for growth in the future, adapting to changing industry conditions is always difficult, and it usually requires more than money. 

Management believes it can produce sales growth in the range of 3% to 4% over the coming years, driven mostly by stronger performance in the U.S. and a growing contribution from the e-commerce segment. Still, Wal-Mart will be fighting an uphill battle against all-mighty Amazon in the online retail battlefield.

Amazon vs. Wal-Mart
The market tends to overreact to bad news, so maybe there is excessive pessimism incorporated in Wal-Mart's current valuation. Conversely, when a company is doing as well as Amazon, there is always the chance that investor optimism can get ahead of a company's fundamentals.

However, the fact is that everything indicates that Amazon will continue outgrowing Wal-Mart by a considerable margin in the years ahead, so invest accordingly.

Andrés Cardenal owns shares of Amazon.com. The Motley Fool owns shares of and recommends Amazon.com. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.