The silkworm Bombyx mori uses 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 determination, suggesting the existence of a dominant feminizing gene in this chromosome. However, the W chromosome is almost fully occupied by transposable element sequences, 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 chromosome, but the function(s) of these piRNAs are unknown. Here we show that a W-chromosome-derived, female-specific piRNA is the feminizing factor of B. mori. This piRNA is produced from a piRNA precursor which we named Fem. Fem sequences were arranged in tandem in the sex-determining region of the W chromosome. Inhibition of Fem-derived piRNA-mediated signalling in female embryos led to the production of the male-specific splice variants of B. mori doublesex (Bmdsx), a gene which acts at the downstream end of the sex differentiation cascade. A target gene of Fem-derived piRNA was identified on the Z chromosome of B. mori. This gene, which we named Masc, encoded a CCCH-type zinc finger protein. We show that the silencing of Masc messenger RNA by Fem piRNA is required for the production of female-specific isoforms of Bmdsx in 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. o̧pyright 2014 Macmillan Publishers Limited.