The silkwormBombyx moriuses a WZ sex determination system that is analogous to the one found in birds and some reptiles. In this system, males have two Z sex chromosomes, whereas females have Z and W sex chromosomes. The silkworm W chromosome has a dominant role in female determination1,2, suggesting the existence of a dominant feminizing gene in this chromosome. However, the W chromosome is almost fully occupied by transposable element sequences3,4,5, and no functional protein-coding gene has been identified so far. Female-enriched PIWI-interacting RNAs (piRNAs) are the only known transcripts that are produced from the sex-determining region of the W chromosome6, but the function(s) of these piRNAs are unknown. Here we show that a W-chromosome-derived, female-specific piRNA is the feminizing factor ofB. mori. This piRNA is produced from a piRNA precursor which we namedFem.Femsequences were arranged in tandem in the sex-determining region of the W chromosome. Inhibition ofFem-derived piRNA-mediated signalling in female embryos led to the production of the male-specific splice variants ofB. mori doublesex(Bmdsx), a gene which acts at the downstream end of the sex differentiation cascade7,8. A target gene ofFem-derived piRNA was identified on the Z chromosome ofB. mori. This gene, which we namedMasc, encoded a CCCH-type zinc finger protein. We show that the silencing ofMascmessenger RNA byFempiRNA is required for the production of female-specific isoforms ofBmdsxin female embryos, and that Masc protein controls both dosage compensation and masculinization in male embryos. Our study characterizes a single small RNA that is responsible for primary sex determination in the WZ sex determination system.