Long-duration gamma-ray bursts (GRBs) originate from ultra-relativistic jets launched from the collapsing cores of dying massive stars. They are characterised by an initial phase of bright and highly variable radiation in the keV-MeV band that is likely produced within the jet and lasts from milliseconds to minutes, known as the prompt emission. Subsequently, the interaction of the jet with the external medium generates external shock waves, responsible for the afterglow emission, which lasts from days to months, and occurs over a broad energy range, from the radio to the GeV bands. The afterglow emission is generally well explained as synchrotron radiation by electrons accelerated at the external shock. Recently, an intense, long-lasting emission between 0.2 and 1 TeV was observed from the GRB 190114C. Here we present the results of our multi-frequency observational campaign of GRB~190114C, and study the evolution in time of the GRB emission across 17 orders of magnitude in energy, from $5times10^{-6}$ up to $10^{12}$,eV. We find that the broadband spectral energy distribution is double-peaked, with the TeV emission constituting a distinct spectral component that has power comparable to the synchrotron component. This component is associated with the afterglow, and is satisfactorily explained by inverse Compton upscattering of synchrotron photons by high-energy electrons. We find that the conditions required to account for the observed TeV component are not atypical, supporting the possibility that inverse Compton emission is commonly produced in GRBs.