Context. The Gaia spacecraft of the European Space Agency (ESA) has been securing observations of solar system objects (SSOs) since the beginning of its operations.
Data Release 2 (DR2) contains the observations of a selected sample of 14,099 SSOs. These asteroids have been already identified and have been numbered by the Minor Planet Center repository.
Positions are provided for each Gaia observation at CCD level. As additional information, complementary to astrometry, the apparent brightness of SSOs in the unfiltered G band is also provided for selected observations.
Aims. We explain the processing of SSO data, and describe the criteria we used to select the sample published in Gaia DR2.
We then explore the data set to assess its quality. Methods.
To exploit the main data product for the solar system in Gaia DR2, which is the epoch astrometry of asteroids, it is necessary to take into account the unusual properties of the uncertainty, as the position information is nearly one-dimensional. When this aspect is handled appropriately, an orbit fit can be obtained with post-fit residuals that are overall consistent with the a-priori error model that was used to define individual values of the astrometric uncertainty.
The role of both random and systematic errors is described. The distribution of residuals allowed us to identify possible contaminants in the data set (such as stars).
Photometry in the G band was compared to computed values from reference asteroid shapes and to the flux registered at the corresponding epochs by the red and blue photometers (RP and BP). Results.
The overall astrometric performance is close to the expectations, with an optimal range of brightness G similar to 12 - 17. In this range, the typical transit-level accuracy is well below 1 mas.
For fainter asteroids, the growing photon noise deteriorates the performance. Asteroids brighter than G similar to 12 are affected by a lower performance of the processing of their signals.
The dramatic improvement brought by Gaia DR2 astrometry of SSOs is demonstrated by comparisons to the archive data and by preliminary tests on the detection of subtle non-gravitational effects.