  We propose a new phase of matter, an electronic phase separation transition
that starts near the upper pseudogap and segregates the holes into high and low
density domains. The Cahn-Hilliard approach is used to follow quantitatively
this second order transition. The resulting grain boundary potential confines
the charge in domains and favors the development of intragrain superconducting
amplitudes. The zero resistivity transition arises only when the intergrain
Josephson coupling $E_J$ is of the order of the thermal energy and phase
locking among the superconducting grains takes place. We show that this
approach explains the pseudogap and superconducting phases in a natural way and
reproduces some recent scanning tunneling microscopy data
