Methods that link genetic variation to steady-state gene expression levels, such as expression quantitative trait loci (eQTLs), are widely used to functionally annotate trait-associated variants, but they are limited in identifying context-dependent effects on transcription. To address this challenge, we developed the cistrome-wide association study (CWAS), a framework for nominating variants that impact traits through their effects on chromatin state. CWAS associates the genetic determinants of cistromes (e.g., the genome-wide profiles of transcription factor binding sites or histone modifications) with traits using summary statistics from genome-wide association studies (GWAS). We performed CWASs of prostate cancer and androgen-related traits, using a reference panel of 307 prostate cistromes from 165 individuals. CWAS nominated susceptibility regulatory elements or androgen receptor (AR) binding sites at 52 out of 98 known prostate cancer GWAS loci and implicated an additional 17 novel loci. We functionally validated a subset of our results using CRISPRi and in vitro reporter assays. At 28 of the 52 risk loci, CWAS identified regulatory mechanisms that are not observable via eQTLs, implicating genes with complex or context-specific regulation that are overlooked by current approaches that relying on steady-state transcript measurements. CWAS genes include transcription factors that govern prostate development such as NKX3-1, HOXB13, GATA2, and KLF5. Moreover, CWAS boosts discovery power in modestly sized GWAS, identifying novel genetic associations mediated through AR binding for androgen-related phenotypes, including resistance to prostate cancer therapy. CWAS is a powerful and biologically interpretable paradigm for studying variants that influence traits by affecting context-dependent transcriptional regulation.