Ventral midline cells at different rostrocaudal levels of the central nervous system exhibit distinct properties but share the ability to pattern the dorsoventral axis of the neural tube. We show here that ventral midline cells acquire distinct identities in response to the different signaling activities of underlying mesoderm. Signals from prechordal mesoderm control the differentiation of rostral diencephalic ventral midline cells, whereas notochord induces floor plate cells caudally. Sonic hedgehog (SHH) is expressed throughout axial mesoderm and is required for the induction of both rostral diencephalic ventral midline cells and floor plate. However, prechordal mesoderm also expresses BMP7 whose function is required coordinately with SHH to induce rostral diencephalic ventral midline cells. BMP7 acts directly on neural cells, modifying their response to SHH so that they differentiate into rostral diencephalic ventral midline cells rather than floor plate cells. Our results suggest a model whereby axial mesoderm both induces the differentiation of overlying neural cells and controls the rostrocaudal character of the ventral midline of the neural tube.