Morrisons said its online grocery service will launch by January 2014.
Morrisons.com will be Morrisons branded. Groceries will be delivered to customers by a Morrisons liveried fleet while Ocado will provide logistical support from it Dordon distribution centre in the Midlands.
Morrisons is the only one of the big four supermarkets, out of Sainsbury’s, Tesco and Asda, not to offer online shopping.
The deal is likely to anger upmarket retailer Waitrose, which has an exclusive grocery supply agreement with Ocado.
Waitrose managing director Mark Price has previously said he would reject a deal between Ocado and Morrisons and he would ask his legal team to investigate any contract signed between the two companies.
Waitrose is understood to preparing a statement reacting to the deal.
The 25-year-deal announced today is a technology and service agreement, along with a leaseback of property and equipment at the Dordon distribution centre.
Morrisons is initially paying out £170m to acquire the distribution centre, with a further £46m invested to expand it.
Dalton Philips, chief executive of Morrisons, said: "This agreement is a significant strategic step for Morrisons. From a standing start, Morrisons, will be competing in the fast growing online channel by the end of this year with a really compelling proposition."
Tim Steiner, chief executive of Ocado, said: "Morrisons’ desire to offer its customers the choice of online shopping illustrates the structural shift we are seeing in favour of the channel. We see Morrisons' decision to adopt our model to drive its online launch as a further endorsement of our technological and logistical excellence."