Acquired ESR1 mutations are a major mechanism of resistance to aromatase inhibitors (AI). We developed ultra-high sensitivity multiplexed digital PCR assays for ESR1 mutations in circulating tumor DNA (ctDNA) and used these to investigate the clinical relevance and origin of ESR1 mutations in a cohort of 171 women with advanced breast cancer. ESR1 mutation status in ctDNA showed high concordance with contemporaneous tumor biopsies, and could be assessed in samples shipped at room temperature in preservative tubes without loss of accuracy. ESR1 mutations were found exclusively in patients with estrogen receptor positive breast cancer previously exposed to AI. Patients with ESR1 mutations had a substantially shorter progression-free survival on subsequent AI-based therapy (HR 3.1, 95%CI 1.9-23.1, log rank p=0.0041). ESR1 mutation prevalence differed markedly between patients that were first exposed to AI during the adjuvant and metastatic settings (5.8% (3/52) vs 36.4% (16/44) respectively, p=0.0002). In an independent cohort, ESR1 mutations were identified in 0% (0/32, 95%CI 0-10.9%) tumor biopsies taken after progression on adjuvant AI. In a patient with serial samples taken during metastatic treatment, ESR1 mutation was selected during metastatic AI therapy, to become the dominant clone in the cancer. ESR1 mutations can be robustly identified with ctDNA analysis and predict for resistance to subsequent AI therapy. ESR1 mutations are rarely acquired during adjuvant AI therapy, but are commonly selected by therapy for metastatic disease, providing evidence that the mechanisms of resistance to targeted therapy may be substantially different between the treatment of micro-metastatic and overt metastatic cancer.