The adenohypophysis (anterior pituitary) is a major centre for systemic hormones. At present, no efficient stem-cell culture for its generation is available, partly because of insufficient knowledge about how the pituitary primordium (Rathke's pouch) is induced in the embryonic head ectoderm. Here we report efficient self-formation of three-dimensional adenohypophysis tissues in an aggregate culture of mouse embryonic stem (ES) cells. ES cells were stimulated to differentiate into non-neural head ectoderm and hypothalamic neuroectoderm in adjacent layers within the aggregate, and treated with hedgehog signalling. Self-organization of Rathke's-pouch-like three-dimensional structures occurred at the interface of these two epithelia, as seen in vivo, and various endocrine cells including corticotrophs and somatotrophs were subsequently produced. The corticotrophs efficiently secreted adrenocorticotropic hormone in response to corticotrophin releasing hormone and, when grafted in vivo, these cells rescued the systemic glucocorticoid level in hypopituitary mice. Thus, functional anterior pituitary tissue self-forms in ES cell culture, recapitulating local tissue interactions.