miRNAs are approximately 22-nt RNA molecules that play important roles in post-transcriptional regulation. We have performed small RNA sequencing in the nematodes Caenorhabditis elegans, C. briggsae, C. remanei, and Pristionchus pacificus, which have diverged up to 400 million years ago, to establish the repertoire and evolutionary dynamics of miRNAs in these species. In addition to previously known miRNA genes from C. elegans and C. briggsae we demonstrate expression of many of their homologs in C. remanei and P. pacificus, and identified in total more than 100 novel expressed miRNA genes, the majority of which belong to P. pacificus. Interestingly, more than half of all identified miRNA genes are conserved at the seed level in all four nematode species, whereas only a few miRNAs appear to be species specific. In our compendium of miRNAs we observed evidence for known mechanisms of miRNA evolution including antisense transcription and arm switching, as well as miRNA family expansion through gene duplication. In addition, we identified a novel mode of miRNA evolution, termed "hairpin shifting," in which an alternative hairpin is formed with up- or downstream sequences, leading to shifting of the hairpin and creation of novel miRNA* species. Finally, we identified 21U-RNAs in all four nematodes, including P. pacificus, where the upstream 21U-RNA motif is more diverged. The identification and systematic analysis of small RNA repertoire in four nematode species described here provides a valuable resource for understanding the evolutionary dynamics of miRNA-mediated gene regulation.