Organisms in many phyla determine sexual fate by distinguishing one X chromosome from two. Here we use the model organism Caenorhabditis elegans to dissect such an X-chromosome-counting mechanism in molecular detail. In this nematode, several genes on the X chromosome called X signal elements communicate X-chromosome dose by controlling the activity of the sex-determination gene xol-1. xol-1 specifies male (XO) fate when active and hermaphrodite (XX) fate when inactive. The only X signal element described so far represses xol-1 post-transcriptionally, but xol-1 is repressed in XX animals by transcriptional and post-transcriptional mechanisms. Here we identify a nuclear-hormone-receptor homologue, SEX-1, that regulates the transcription of xol-1. We show that sex-1 is vital to X-chromosome counting: changing sex-1 gene dose in XX or XO embryos causes sexual transformation and death from inadequate dosage compensation (the hermaphrodite-specific process that equalizes X-gene expression between the sexes). The SEX-1 protein acts directly on xol-1, associating with its promoter in vivo and repressing xol-1 transcription in XX embryos. Thus, xol-1 is the direct molecular target of the primary sex-determination signal, and the dose of a nuclear hormone receptor helps to communicate X-chromosome number to determine nematode sex.