Walmart Inc. sales rose rapidly in stores and online in recent weeks as shoppers, worried about the spread of coronavirus, rushed to stockpile water, face masks and canned goods before shifting their focus to necessities for a prolonged stretch at home.

Walmart sales from its over 4,700 U.S. stores increased nearly 20% over the past four weeks compared with the same period last year, according to documents viewed by The Wall Street Journal.

...