Whole-genome positive selection and habitat-driven evolution in a shallow and a deep-sea urchin. Comparisons of genomic sequence between divergent species can provide insight into the action of natural selection across many distinct classes of proteins. Here, we examine the extent of positive selection as a function of tissue-specific and stage-specific gene expression in two closely-related sea urchins, the shallow-water Strongylocentrotus purpuratus and the deep-sea Allocentrotus fragilis, which have diverged greatly in their adult but not larval habitats. Genes that are expressed specifically in adult somatic tissue have significantly higher dN/dS ratios than the genome-wide average, whereas those in larvae are indistinguishable from the genome-wide average. Testis-specific genes have the highest dN/dS values, whereas ovary-specific have the lowest. Branch-site models involving the outgroup S. franciscanus indicate greater selection (ω(FG)) along the A. fragilis branch than along the S. purpuratus branch. The A. fragilis branch also shows a higher proportion of genes under positive selection, including those involved in skeletal development, endocytosis, and sulfur metabolism. Both lineages are approximately equal in enrichment for positive selection of genes involved in immunity, development, and cell-cell communication. The branch-site models further suggest that adult-specific genes have experienced greater positive selection than those expressed in larvae and that ovary-specific genes are more conserved (i.e., experienced greater negative selection) than those expressed specifically in adult somatic tissues and testis. Our results chart the patterns of protein change that have occurred after habitat divergence in these two species and show that the developmental or functional context in which a gene acts can play an important role in how divergent species adapt to new environments.