Pluripotency of embryonic stem (ES) cells is controlled by defined transcription factors1,2. During differentiation, mouse ES cells undergo global epigenetic reprogramming, as exemplified by X-chromosome inactivation (XCI) whereby one female X-chromosome is silenced to achieve gene dosage parity between the sexes3-5. Somatic XCI is regulated by homologous X-chromosome pairing6,7, counting8-10, and random choice of future active X (Xa) and inactive X’s. XCI and cell differentiation are tightly coupled11, as blocking one process compromises the other8,12 and dedifferentiation of somatic cells to induced pluripotent stem (iPS) cells is accompanied by X-reactivation2. Recent evidence suggests coupling of Xist expression to pluripotency factors13, but how the two are interconnected remains unknown. Here, we show that the Oct414 lies at the top of the XCI hierarchy and regulates XCI by triggering X-chromosome pairing and counting. Oct4 directly binds Tsix and Xite, two regulatory ncRNA genes of the X-inactivation center15,16, and also complexes with XCI trans-factors, Ctcf and Yy117, through protein-protein interactions. Depletion of Oct4 blocks homologous X-chromosome pairing and results in inactivation of both Xs in female cells. Thus, we have identified the first trans-factor that regulates counting and ascribed novel functions to Oct4 during X-chromosome reprogramming.