Context. The second release of Gaia data (Gaia DR2) contains the astrometric parameters for more than half a million quasars.
This set defines a kinematically non-rotating reference frame in the optical domain. A subset of these quasars have accurate VLBI positions that allow the axes of the reference frame to be aligned with the International Celestial Reference System (ICRF) radio frame.
Aims. We describe the astrometric and photometric properties of the quasars that were selected to represent the celestial reference frame of Gaia DR2 (Gaia-CRF2), and to compare the optical and radio positions for sources with accurate VLBI positions.
Methods. Descriptive statistics are used to characterise the overall properties of the quasar sample.
Residual rotation and orientation errors and large-scale systematics are quantified by means of expansions in vector spherical harmonics. Positional differences are calculated relative to a prototype version of the forthcoming ICRF3.
Results. Gaia-CRF2 consists of the positions of a sample of 556 869 sources in Gaia DR2, obtained from a positional cross-match with the ICRF3-prototype and AllWISE AGN catalogues.
The sample constitutes a clean, dense, and homogeneous set of extragalactic point sources in the magnitude range G similar or equal to 16 to 21 mag with accurately known optical positions. The median positional uncertainty is 0.12 mas for G < 18 mag and 0.5 mas at G = 20 mag.
Large-scale systematics are estimated to be in the range 20 to 30 mu as. The accuracy claims are supported by the parallaxes and proper motions of the quasars in Gaia DR2.
The optical positions for a subset of 2820 sources in common with the ICRF3-prototype show very good overall agreement with the radio positions, but several tens of sources have significantly discrepant positions. Conclusions.
Based on less than 40% of the data expected from the nominal Gaia mission, Gaia-CRF2 is the first realisation of a non-rotating global optical reference frame that meets the ICRS prescriptions, meaning that it is built only on extragalactic sources. Its accuracy matches the current radio frame of the ICRF, but the density of sources in all parts of the sky is much higher, except along the Galactic equator.