The Mediator complex, which in humans is 1.4 MDa in size and includes 26 subunits, controls many aspects of RNA polymerase II (Pol II) function. Apart from its size, a defining feature of Mediator is its intrinsic disorder and conformational flexibility, which contributes to its ability to undergo phase separation and to interact with a myriad of regulatory factors. In this Review, we discuss Mediator structure and function, with emphasis on recent cryogenic electron microscopy data of the 4.0-MDa transcription preinitiation complex. We further discuss how Mediator and sequence-specific DNA-binding transcription factors enable enhancer-dependent regulation of Pol II function at distal gene promoters, through the formation of molecular condensates (or transcription hubs) and chromatin loops. Mediator regulation of Pol II reinitiation is also discussed, in the context of transcription bursting. We propose a working model for Mediator function that combines experimental results and theoretical considerations related to enhancer–promoter interactions, which reconciles contradictory data regarding whether enhancer–promoter communication is direct or indirect. We conclude with a discussion of Mediator’s potential as a therapeutic target and of future research directions.