Ultrarelativistic collisions of heavy atomic nuclei produce an extremely hot and dense phase of matter, known as quark–gluon plasma (QGP), which behaves like a near-perfect fluid with the smallest specific shear viscosity—the ratio of the shear viscosity to the entropy density—of any known substance1. Due to its transience (lifetime ~ 10−23 s) and microscopic size (10−14 m), the QGP cannot be observed directly, but only through the particles it emits; however, its characteristics can be inferred by matching the output of computational collision models to experimental observations. Previous work, using viscous relativistic hydrodynamics to simulate QGP, has achieved semiquantitative constraints on key physical properties, such as its specific shear and bulk viscosity, but with large, poorly defined uncertainties2–8. Here, we present the most precise estimates so far of QGP properties, including their quantitative uncertainties. By applying established Bayesian parameter estimation methods9 to a dynamical collision model and a wide variety of experimental data, we extract estimates of the temperature-dependent specific shear and bulk viscosity simultaneously with related initial-condition properties. The method is extensible to other collision models and experimental data and may be used to characterize additional aspects of high-energy nuclear collisions. As the quark–gluon plasma is a short-lived state of matter, its properties cannot be measured directly. A Bayesian parameter estimation method now provides a reliable estimation of the temperature-dependent specific shear and bulk viscosities.