Fungal transcription factor Upc2 senses ergosterol levels and regulates sterol biosynthesis and uptake. Constitutive activation of Upc2 causes azole resistance in Candida species. We determined the structure of ergosterol-bound Upc2, revealing the ligand specificity and transcriptional regulation. Ergosterol binding involves conformational changes of the ligand-binding domain, creating a shape-complementary hydrophobic pocket. The conserved helix α12 and glycine-rich loop are critical for sterol recognition by forming the pocket wall. The mutations of the glycine-rich loop inhibit ligand binding by steric clashes and constitutively activate Upc2. The translocation of Upc2 is regulated by Hsp90 chaperone in a sterol-dependent manner. Ergosterol-bound Upc2 associates with Hsp90 using the C-terminal tail, which retains the inactive Upc2 in the cytosol. Ergosterol dissociation induces a conformational change of the C-terminal tail, releasing Upc2 from Hsp90 for nuclear transport by importin α. The understanding of the regulatory mechanism provides an antifungal target for the treatment of azole-resistant Candida infections.