Wal-Mart Stores Inc. agreed to buy e-commerce startup Jet.com Inc. for about $3 billion in cash, giving the world’s largest retailer the resources for a stronger shopping website to compete with Amazon.com Inc., the online market leader.

The deal also includes $300 million in Wal-Mart shares that will be paid over time, the world’s largest retailer said Monday in a statement. Acquiring Jet.com, which achieved a $1 billion gross merchandise run rate in a little more than a year, gives Wal-Mart a website that processes an average of 25,000 orders a day and is adding 400,000 shoppers monthly.

Wal-Mart has spent billions expanding its online operation, including hiring thousands of workers, opening two offices in Silicon Valley, and building large e-commerce distribution centers. It also started an annual subscription service similar at half the price to Amazon Prime. Amazon’s $99-a-year service provides free two-day shipping on millions of items, encouraging shoppers to stay on the website, as well as the company’s video entertainment offerings.

Hoboken, New Jersey-based Jet.com has distinguished itself in e-commerce through “gain sharing,” luring buyers to add items to their orders to reduce shipping costs, and to pay with debit instead of credit cards to reduce transaction fees. Traditional store-based mass retailers such as Wal-Mart, Target Corp. and Costco Wholesale Corp. have been struggling to fend off Amazon’s momentum in online shopping.

“For Wal-Mart to protect its household products lead from Amazon, it must address the rising reliance of Amazon shoppers on free shipping,” Jitendra Waral, a Bloomberg Intelligence senior industry analyst, wrote in an Aug. 4 research note. Jet.com “could bring a nascent e-commerce platform that Wal-Mart could scale.”

The deal gives Wal-Mart control over Jet.com’s proprietary technology and its customer database. Wal-Mart’s online sales were about $14 billion last year, 14% of Amazon’s product and service revenues of $99 billion. Wal-Mart Chief Executive Officer Doug McMillon said last month that the company’s online operation has taken too long to grow.