Src homology 2 (SH2) domains play a central role in signal transduction. Although many SH2 domains have been validated as drug targets, their structural similarity makes development of specific inhibitors difficult. The cancer-relevant transcription factors STAT5a and STAT5b are particularly challenging small-molecule targets because their SH2 domains are 93 % identical on the amino acid level. Here we present the natural product-inspired development of the low-nanomolar inhibitor Stafib-1, as the first small molecule which inhibits the STAT5b SH2 domain (Ki=44 nm) with more than 50-fold selectivity over STAT5a. The binding site of the core moiety of Stafib-1 was validated by functional analysis of point mutants. A prodrug of Stafib-1 was shown to inhibit STAT5b with high selectivity over STAT5a in tumor cells. Stafib-1 provides the first demonstration that naturally occurring SH2 domains with more than 90 % sequence identity can be selectively targeted with small organic molecules.