To advance our understanding of the genetic programs that drive cell and tissue specialization, it is necessary to obtain a comprehensive overview of gene expression patterns. Here, we have used RNA tomography to generate the first high-resolution, anteroposterior gene expression maps of C. elegans males and hermaphrodites. To explore these maps, we have developed computational methods for discovering region and tissuespecific genes. Moreover, by combining pattern-based analysis with differential gene expression analysis, we have found extensive sex-specific gene expression differences in the germline and sperm. We have also identified genes that are specifically expressed in the male reproductive tract, including a group of uncharacterized genes that encode small secreted proteins that are required for male fertility. We conclude that spatial gene expression maps provide a powerful resource for identifying novel tissue-specific gene functions in C. elegans. Importantly, we found that expression maps from different animals can be precisely aligned, which opens up new possibilities for transcriptome-wide comparisons of gene expression patterns.