It is well established that Solar-mass stars gain mass via disk accretion, until the mass reservoir of the disk is exhausted and dispersed, or condenses into planetesimals. Accretion disks are intimately coupled with mass ejection via polar cavities, in the form of jets and less collimated winds, which allow mass accretion through the disk by removing a substantial fraction of its angular momentum. Whether disk accretion is the mechanism leading to the formation of stars with much higher masses is still unclear. Here, we are able to build a comprehensive picture for the formation of an O-type star, by directly imaging a molecular disk which rotates and undergoes infall around the central star, and drives a molecular jet which arises from the inner disk regions. The accretion disk is truncated between 2000-3000au, it has a mass of about a tenth of the central star mass, and is infalling towards the central star at a high rate (6x10^-4 Msun/yr), as to build up a very massive object. These findings, obtained with the Atacama Large Millimeter/submillimeter Array at 700au resolution, provide observational proof that young massive stars can form via disk accretion much like Solar-mass stars.