Sainsbury's has agreed to buy Walmart's Asda for about £7.3 billion to create Britain's biggest supermarket group by market share, overtaking long-standing industry leader Tesco.
Bringing together Britain's second and third-largest supermarket groups could generate the savings and buying power to help them better compete with fast-growing German discounters and growth at Tesco after its purchase of wholesaler Booker.
The cash and shares deal could also provide a potential exit route for Walmart, as Asda, which it bought in 1999 for £6.7 billion, has been struggling to grow over the last five years as discounters Aldi and Lidl attract its price-conscious customers.
Sainsbury's shares closed almost 17% higher - their highest since July 2014 - while shares in rival Tesco fell.
Walmart will receive £3 billion in cash and a 42% stake in the combined business' equity, valuing Asda at about £7.3 billion.
Sainsbury's CEO Mike Coupe will retain that position in the merged company, which will keep the Sainsbury's and Asda brands.
Analysts said the deal was a bet that recent changes in the retail industry - including the rise in online shopping, hard discounters and Tesco's purchase of Booker - would ease any opposition from competition regulators.
They said that if regulators included discounters - which sell a much smaller range of products - in their assessment of major competitors for the new group, it might only have to sell about 8% of stores.
But if they do not include discounters, disposals might have to reach 15% of stores, which could undermine the deal. food margin trends.
Sainsbury's Coupe said divestments were possible, but there were no plans to close shops and so customers would be unaffected.
"Even if we have to divest stores they will be sold as trading entities," he said.
Together Sainsbury's and Asda have 2,800 stores.
The deal comes as Britain's big four grocers continue to lose share to Aldi and Lidl and are also having to deal with growing demand for internet grocery shopping and the relentless march of Amazon.
It follows Tesco strengthening its position with the completion of a £4 billion takeover of wholesaler Booker two months ago.
The surprise decision by Britain's Competition and Markets Authority to unconditionally clear the Tesco/Booker deal may have encouraged Sainsbury's and Asda to believe they could get a transaction through, albeit with some store disposals.
The two companies have different cultures and appeal to different customers, with London-based Sainsbury's strong in own-brand products, and Asda focused on price.
Sainsbury's said the combination would generate synergies of at least £500m and enable prices to be lowered by about 10% on many products.
Jefferies analysts said it was a bold move by Coupe, who led Sainsbury's in the purchase of general retailer Argos in 2016.
"Sainsbury's continues to surprise us with their aggressive deal-making," said the analysts, who have a "hold" rating on the supermarket group's stock.
But others pointed to the risks of bringing together companies with different cultures, noting that Morrisons-Safeway lost 28% of their sales through a combination of store sales, integration problems and culture clash during the last big UK grocery merger over a decade ago.
The Qatar Investment Authority, currently the largest shareholder in Sainsbury’s with a 22% stake, said it supported the deal.
After a two-year lock-up period, Walmart is allowed to reduce its stake in the combined group to 29.9%, and after four years could exit completely.
Sainsbury's also reported its full-year results today, which showed underlying pretax profit grew 1.4 % in the 12 months to March 10 to £589m.
It was helped by the delivery of synergies from its 2016 takeover of Argos, efficiency savings and improving food margin trends.