A continuum version of the virial theorem is derived for a radiating self-gravitating accretion disc around a compact object. The central object is point-like, but we can avoid the regularization of its gravitational potential. This is achieved by applying a modified Pohozaev–Rellich identity to the gravitational potential of the disc only. The theorem holds for general stationary configurations, including discontinuous flows (shock waves, contact discontinuities). It is used to test numerical solutions of a model of self-gravitating radiative accretion discs. The presented virial theorem should be useful in the analysis of those (possibly radiating) hydrodynamical systems in astrophysics where the central mass and the mass of the fluid are comparable and none of them can be neglected.