Bacterial type IV secretion systems translocate virulence factors into eukaryotic cells, distribute genetic material between bacteria and have shown potential as a tool for the genetic modification of human cells. Given the complex choreography of the substrate through the secretion apparatus, the molecular mechanism of the type IV secretion system has proved difficult to dissect in the absence of structural data for the entire machinery. Here we use electron microscopy to reconstruct the type IV secretion system encoded by the Escherichia coli R388 conjugative plasmid. We show that eight proteins assemble in an intricate stoichiometric relationship to form an approximately 3 megadalton nanomachine that spans the entire cell envelope. The structure comprises an outer membrane-associated core complex connected by a central stalk to a substantial inner membrane complex that is dominated by a battery of 12 VirB4 ATPase subunits organized as side-by-side hexameric barrels. Our results show a secretion system with markedly different architecture, and consequently mechanism, to other known bacterial secretion systems.