Abstract Background Sex chromosomes often evolve exceptionally fast and degenerate after recombination arrest. However, the underlying evolutionary processes are under persistent debate, particularly whether or not recombination arrest evolves in a stepwise manner and how switches in sex determination genes contribute to sex chromosome evolution. Here, we study sex determination in the dioecious plant genus Salix with a high turnover of sex chromosomes. Results We identified Z and W sex-linked regions (~ 8 Mb) on chromosome 15 of the dwarf willow Salix herbacea using a new haplotype-resolved assembly. The W sex-linked region harboured a large (5 Mb) embedded inversion. Analyses of synteny with other Salix species, sequence divergence between sex chromosomes and degeneration suggest that the inversion recently incorporated pseudoautosomal sequences into the sex-linked region, extending its length nearly three-fold. W-hemizygous regions exclusively contained seven pairs of inverted partial repeats of the male essential floral identity gene PISTILLATA, suggesting a possible PISTILLATA suppression mechanism by interfering RNA in females. Such PISTILLATA pseudogenes were also found in other Salix species with ZW sex determination but not in those with XY sex determination. Conclusions Our study provides rare and compelling direct support for the long-standing theory of stepwise recombination reduction mediated by inversions and suggests that the turnover of sex chromosomes in the Salicaceae family is associated with a switch of the sex determination gene.