Eukaryotic genomes are colonized by transposons whose uncontrolled activity causes genomic instability. The piRNA pathway silences transposons in animal gonads, yet how this is achieved molecularly remains controversial. Here, we show that the HMG protein Maelstrom is essential for Piwi-mediated silencing in Drosophila. Genome-wide assays revealed highly correlated changes in RNA polymerase II recruitment, nascent RNA output, and steady-state RNA levels of transposons upon loss of Piwi or Maelstrom. Our data demonstrate piRNA-mediated trans-silencing of hundreds of transposon copies at the transcriptional level. We show that Piwi is required to establish heterochromatic H3K9me3 marks on transposons and their genomic surroundings. In contrast, loss of Maelstrom affects transposon H3K9me3 patterns only mildly yet leads to increased heterochromatin spreading, suggesting that Maelstrom acts downstream of or in parallel to H3K9me3. Our work illustrates the widespread influence of transposons and the piRNA pathway on chromatin patterns and gene expression.