Walmart Inc. reported same-store sales growth at the strongest levels in more than a decade, offsetting analyst concerns about major investments in areas like e-commerce, where the retail giant expects to have losses for the year.

Walmart WMT, -0.26% U.S. saw same-store sales jump 4.5% during the second quarter, with traffic and ticket growth of more than 2%. Sales of $128.0 billion, beat the FactSet consensus of $126.0 billion.