The young massive Jupiters discovered with high-contrast imaging1-4 provide a unique opportunity to study the formation and early evolution of gas giant planets. A key question is to what extent gravitational energy from accreted gas contributes to the internal energy of a newly formed planet. This has led to a range of formation scenarios from `cold' to `hot' start models5-8. For a planet of a given mass, these initial conditions govern its subsequent evolution in luminosity and radius. Except for upper limits from radial velocity studies9,10, disk modelling11 and dynamical instability arguments12, no mass measurements of young planets are yet available to distinguish between these different models. Here, we report on the detection of the astrometric motion of Beta Pictoris, the 21-Myr-old host star of an archetypical directly imaged gas giant planet, around the system's centre of mass. Subtracting the highly accurate Hipparcos13,14 and Gaia15,16 proper motion from the internal 3 yr Hipparcos astrometric data reveals the reflex motion of the star, giving a model-independent planet mass of 11 ± 2 Jupiter masses. This is consistent with scenarios in which the planet is formed in a high-entropy state as assumed by hot start models. The ongoing data collection by Gaia will soon lead to mass measurements of other young gas giants and form a great asset to further constrain early-evolution scenarios.