The nuclear export of messenger RNA (mRNA) is an important step in eukaryotic gene expression. Despite recent molecular insights into how newly transcribed mRNAs are packaged into ribonucleoprotein complexes (mRNPs), the subsequent events that govern mRNA export are poorly understood. Here, we uncover the molecular basis underlying key events of human mRNA export, including the remodeling of mRNP-bound transcription-export complexes (TREX), the formation of export-competent mRNPs, the docking of mRNPs at the nuclear pore complex (NPC), and the release of mRNPs at the NPC to initiate their export. Our biochemical and structural data show that the ATPase DDX39/UAP56 acts as a central molecular switch that directs nucleoplasmic mRNPs from TREX to NPC-anchored TREX-2 complexes through its ATP-gated mRNA-binding cycle. Collectively, these findings establish a mechanistic framework for a general and evolutionarily conserved mRNA export pathway.