Mouse ES cells can differentiate into all three germ layers of the embryo but are generally excluded from the trophoblast lineage. Here we show that ES cells deficient in DNA methylation can differentiate efficiently into trophoblast derivatives. In a genome-wide screen we identified the transcription factor Elf5 as methylated and repressed in ES cells, and hypomethylated and expressed in TS and methylation-deficient ES cells. Elf5 creates a positive-feedback loop with the TS cell determinants Cdx2 and Eomes that is restricted to the trophoblast lineage by epigenetic regulation of Elf5. Importantly, the late-acting function of Elf5 allows initial plasticity and regulation in the early blastocyst. Thus, Elf5 functions as a gatekeeper, downstream of initial lineage determination, to reinforce commitment to the trophoblast lineage or to abort this pathway in epiblast cells. This epigenetic restriction of cell lineage fate provides a molecular mechanism for Waddington's concept of canalization of developmental pathways.