Walmart (WMT), the bricks-and-mortar giant that's struggled to compete against Amazon (AMZN), is surprising investors as its stock has raced past the e-commerce leader in June, according to a detailed story in the Wall Street Journal. Even more impressively, the retailer's stock has surged by more than 18% so far in 2019 and gained about 33% over the past 12 months. It's dramatically outperformed other retailers in the SPDR S&P Retail ETF (XRT), which has gained less than 2.5% this year and has fallen during the past 12 months.

Walmart's Stock Vs. Rivals (1 Year, YTD)

Walmart: +32.75%, +18.10%)
SPDR S&P Retail ETF: -15.20%, +2.44%

Source: Investopedia, Yahoo Finance

Walmart Flies High

There are several reasons why Walmart shares are outpacing Amazon this month, according to articles in the Journal and Barron's. For starters, the stock market's wild swings have prompted many investors to seek safety in companies such as Walmart, a consumer staples stock that sells household items. That's one reason Walmart's stock this month has been in the midst of its longest streak of consecutive daily gains since 2017, the Journal says. A second reason for Walmart's strength may be that its e-commerce business is making major progress and its core bricks-and-mortar business is posting "solid sales," according to Stifel analyst Mark Astrachan, per Barron's. Walmart's e-commerce business is showing promise amid its “shift to higher margin categories apparel and home, particularly with the addition of exclusive brands,” Astrachan told the publication. Last, Walmart's stock has gained steam as Amazon's shares face several headwinds, including an expected antitrust investigation. Amazon's shares have gone nowhere during the past six weeks.

What's Next

To be sure, it's unclear whether Walmart's shares will stay ahead of Amazon, but it may continue to outperform the overall market. Strengthening its e-commerce business will be a key to its success. Three years after buying startup Jet.com for $3.3 billion, Walmart is now merging the once highly touted purchase into the company's larger e-commerce operations, per the Wall Street Journal. This suggests that the company, for all its recent successes, may have not yet figured out the perfect balance between its bricks-and-mortar stores and its e-commerce aspirations.