The largest subunit of RNA polymerase II (RNAPII) C-terminal heptarepeat domain (CTD) is subject to phosphorylation during initiation and elongation of transcription by RNA polymerase II. Here we study the molecular mechanisms leading to phosphorylation of Ser-7 in the human enzyme. Ser-7 becomes phosphorylated before initiation of transcription at promoter regions. We identify cyclin-dependent kinase 7 (CDK7) as one responsible kinase. Phosphorylation of both Ser-5 and Ser-7 is fully dependent on the cofactor complex Mediator. A subform of Mediator associated with an active RNAPII is critical for preinitiation complex formation and CTD phosphorylation. The Mediator-RNAPII complex independently recruits TFIIB and CDK7 to core promoter regions. CDK7 phosphorylates Ser-7 selectively in the context of an intact preinitiation complex. CDK7 is not the only kinase that can modify Ser-7 of the CTD. ChIP experiments with chemical inhibitors provide evidence that other yet to be identified kinases further phosphorylate Ser-7 in coding regions.