At particle collider experiments, elementary particle interactions with large momentum transfer produce quarks and gluons (known as partons) whose evolution is governed by the strong force, as described by the theory of quantum chromodynamics (QCD). The vacuum is not transparent to the partons and induces gluon radiation and quark pair production in a process that can be described as a parton shower. Studying the pattern of the parton shower is one of the key experimental tools in understanding the properties of QCD. This pattern is expected to depend on the mass of the initiating parton, through a phenomenon known as the dead-cone effect, which predicts a suppression of the gluon spectrum emitted by a heavy quark of mass $m$ and energy $E$, within a cone of angular size $m$/$E$ around the emitter. A direct observation of the dead-cone effect in QCD has not been possible until now, due to the challenge of reconstructing the cascading quarks and gluons from the experimentally accessible bound hadronic states. We report the first direct observation of the QCD dead-cone by using new iterative declustering techniques to reconstruct the parton shower of charm quarks. This result confirms a fundamental feature of QCD, which is derived more generally from its origin as a gauge quantum field theory. Furthermore, the measurement of a dead-cone angle constitutes a direct experimental observation of the non-zero mass of the charm quark, which is a fundamental constant in the standard model of particle physics.