Almost every animal lineage is characterized by unique sex-specific traits, implying that such traits are gained and lost frequently in evolution. However, the genetic mechanisms responsible for these changes are not understood. In Drosophila, the activity of the sex determination pathway is restricted to sexually dimorphic tissues, suggesting that spatial regulation of this pathway may contribute to the evolution of sex-specific traits. We examine the regulation and function of doublesex (dsx), the main transcriptional effector of the sex determination pathway, in the development and evolution of Drosophila sex combs. Sex combs are a recent evolutionary innovation and show dramatic diversity in the relatively few Drosophila species that have them. We show that dsx expression in the presumptive sex comb region is activated by the HOX gene Sex combs reduced (Scr), and that the male isoform of dsx up-regulates Scr so that both genes become expressed at high levels in this region in males but not in females. Precise spatial regulation of dsx is essential for defining sex comb position and morphology. Comparative analysis of Scr and dsx expression reveals a tight correlation between sex comb morphology and the expression patterns of both genes. In species that primitively lack sex combs, no dsx expression is observed in the homologous region, suggesting that the origin and diversification of this structure were linked to the gain of a new dsx expression domain. Two other, distantly related fly lineages that independently evolved novel male-specific structures show evolutionary gains of dsx expression in the corresponding tissues, where dsx may also be controlled by Scr. These findings suggest that changes in the spatial regulation of sex-determining genes are a key mechanism that enables the evolution of new sex-specific traits, contributing to some of the most dramatic examples of phenotypic diversification in nature.