Kroger Co. (KR) has signed an exclusive deal to use British online grocer Ocado’s cutting-edge automated technology for its delivery services.

Ocado said in a statement that it will give Kroger the rights to its technology in the U.S. on an exclusive basis, in exchange for “monthly exclusivity and consultancy fees which will offset in part the total fees that are expected to be agreed between the two parties.” Under the terms of the deal, Kroger will also buy a 5% stake in Ocado for £183 million ($248 million).

Ocado, which was founded by former Goldman Sachs Group Inc. (GS) employees in 2000 as an online-only supermarket, is expected to help Kroger to slash its supply chain costs, close old distribution centers and better compete with U.S. rivals Amazon.com Inc. (AMZN) and Walmart Inc. (WMT). The British company, now a renowned technology provider for supermarkets, uses robotics and automation to maximize efficiency when packing and shipping grocery orders.

Kroger is keen to use Ocado’s technology to build at least 20 new automated warehouses in the U.S. over the next three years. Plans are already underway to identify three new sites in 2018. (See also: Amazon Prime Members to Receive 10% Off Whole Foods Sale Items.)

"The opportunity to partner with Kroger to transform the way in which US customers buy groceries represents a huge opportunity to redefine the grocery experience of Kroger's customers and create value for the stakeholders of both Kroger and Ocado,” said Ocado CEO Tim Steiner. "As we work through the terms of the services agreement with Kroger in the coming months, we will be preparing the business for a transformative relationship which will reshape the food retailing industry in the U.S. in the years to come."

Ocado’s share price rose more than 40% on Thursday morning trading in London.

Earlier this week, Brittain Ladd, a former Amazon executive who was hired by Kroger last year to assess the grocer's digital and supply chain strategies, told Business Insider that he had been urging his colleagues to strike a deal with Ocado and even potentially acquire the British firm for $2 billion. During the interview, Ladd said that Ocado is “years ahead of everybody else” and could “greatly reduce their [Kroger's] supply chain costs" and enable the U.S. grocer "to probably close nearly half of their older distribution centers."