Shares of Walmart (NYSE:WMT) were up about 10% last week after the company reported quarterly earnings... but at what price?

In this clip from MarketFoolery, analysts explain how Walmart got its revenue and comp sales up so high this quarter and what that means for the bigger picture. Then, the hosts look at Walmart's long-term potential and what investors should keep in mind before buying the retailer today.

A full transcript follows the video.

This video was recorded on Aug. 16, 2018.

Mac Greer: Guys, let's begin with blowout earnings from Walmart. Shares up almost 10% at the time of our taping. Ron, strongest same-store sales growth in a decade. U.S. e-commerce up 40%. That sounds good to me.

Ron Gross: Yeah. What more do you need to know? I mean, these are strong numbers. Comp sales up 4.5%. Total revenue up almost 4%. As you said, e-commerce up 40%. Very, very important there.

The company certainly helped by strong unemployment in the country, the tax cuts that people are benefiting from. People have extra disposable income. It's flowing through to Walmart. Four straight years of U.S. growth. Longtime listeners will remember, it doesn't seem like four years ago, but we used to talk about how horrible the U.S. business was, and how if Walmart didn't get it together, this was going to be really, devastating. To their credit, they turned around.

Now, not everything is peaches and cream. These good numbers do have a cost. The cost is in margins that are under pressure. That's because they have to spend heavily, they're investing heavily online to compete with Amazon, who else, and others. There's a constant price war going on. You have lowering of prices, you have increased commodity, increased transportation costs. So, you actually have margin pressure. You see operating income actually declining, even though this is, yes, a very strong report.

Greer: Such a buzzkill. Andy?

Gross: I'm an analyst, not a cheerleader, my friend. [laughs]

Andy Cross: It's a really good point. The investments they're making are so substantial. I mean, you just look at the partnerships they're making. We'll talk a little bit about the JD.com. They're buying Flipkart, which is India's e-commerce business. They're making a bet, they bought Bonobos last year for $300 million. When you look at all of those investments that they're making, and just think about, Ron mentioned the comp store growth. Traffic was up 2.2%. It was at 1.3% this time last year. Ticket, Mac, pricing, it was up 2.3% vs. 0.5% last year. It's not just that traffic is actually making progress, but they are actually now seeing a little bit of pricing into their business, which is fantastic.

Greer: OK, Ron, you mentioned Amazon earlier. I have top to bring it to the stock level because we are a show for investors. It appears clear that there is room for both Amazon and Walmart, the businesses. The question is, over the next five to 10 years, can both of those stocks be market-beating stocks? Or, ultimately, is it a zero-sum game, do you think?

Gross: That's interesting. Walmart is not a market-beating stock over the last five years. It's done fine, but you would have been better off in an index fund, quite frankly. To their credit, as we've said, they did turn things around. They're now trading at around 19-20X forward earnings in a market that's only 17-18X. You're paying a premium to the market to own Walmart. I don't think that bodes well from a market-beating perspective.

Now, Amazon's a whole other thing. They have so many things going on. They can pull all different levers and turn up the profitability and turn down the profitability and go in so many different places, whether it's the cloud or whether it's online retail. I believe Amazon can be a market-beater, where I think Walmart, it may be a bit of a struggle.

Cross: Yeah, I'll echo that. You have a nice business that's a $270 billion market cap. They might be able to get $5 in earnings per share next year. The profit picture is going to be a little bit tight. Frankly, I think Home Depot is a much better buy. I own Home Depot, and I'd still buy that today.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Andy Cross owns shares of Home Depot. Mac Greer owns shares of Amazon. Ron Gross owns shares of Amazon. The Motley Fool owns shares of and recommends Amazon and JD.com. The Motley Fool has the following options: short September 2018 $180 calls on Home Depot and long January 2020 $110 calls on Home Depot. The Motley Fool recommends Home Depot. The Motley Fool has a disclosure policy.