All cellular systems evolve ways to combat predators and genomic parasites. In bacteria and archaea, numerous resistance mechanisms have developed against phage. Our understanding of this defensive repertoire has recently been expanded to include the CRISPR system of clustered, regularly interspaced short palindromic repeats. In this remarkable pathway, short sequence tags from invading genetic elements are actively incorporated into the host's CRISPR locus to be transcribed and processed into a set of small RNAs that guide the destruction of foreign genetic material. Here we review the inner workings of this adaptable and heritable immune system and draw comparisons to small RNA-guided defense mechanisms in eukaryotic cells.