Understanding how protein structures and functions have diversified is a central goal in molecular evolution. Surveys of very divergent proteins from model organisms, however, are often insufficient to determine the features of ancestral proteins and to reveal the evolutionary events that yielded extant diversity. Here we combine genomic, biochemical, functional, structural, and phylogenetic analyses to reconstruct the early evolution of nuclear receptors (NRs), a diverse superfamily of transcriptional regulators that play key roles in animal development, physiology, and reproduction. By inferring the structure and functions of the ancestral NR, we show--contrary to current belief--that NRs evolved from a ligand-activated ancestral receptor that existed near the base of the Metazoa, with fatty acids as possible ancestral ligands. Evolutionary tinkering with this ancestral structure generated the extraordinary diversity of modern receptors: sensitivity to different ligands evolved because of subtle modifications of the internal cavity, and ligand-independent activation evolved repeatedly because of various mutations that stabilized the active conformation in the absence of ligand. Our findings illustrate how a mechanistic dissection of protein evolution in a phylogenetic context can reveal the deep homology that links apparently "novel" molecular functions to a common ancestral form.