This could speed up the roll-out of superfast 4G services in the UK, with the two firms saying that its network will be in place by 2015, two years ahead of regulator Ofcom's requirement of 98% coverage by 2017.
4G mobile services will enable users to download music and videos to their smartphones and tablets at high speed.
Although the two firms will continue to compete against each other in the mobile market, they will pool their network infrastructure.
"Exceptional customer demand for the mobile internet has challenged the mobile industry to consider innovative solutions to building a nationwide network that will be fit for our customers in the future and support the products and services that will truly make Britain digital," says Ronan Dunne, chief executive of Telefonica UK.
Guy Laurence, Vodafone UK chief executive, adds: "This partnership will close the digital divide for millions of people across the country and power the next phase of the smartphone revolution."
Last month Vodafone, O2 and Three tried to block Everything Everywhere (which operates Orange and T-Mobile) rolling out its 4G mobile services before they do.