Context. The Sco OB2 association is the nearest OB association, extending over approximately 2000 square degrees on the sky. Only its brightest and most massive members are already known (from HIPPARCOS) across its entire size, while studies of its lower mass population refer only to small portions of its extent. Aims. In this work we exploit the capabilities of Gaia DR2 measurements to search for Sco OB2 members across its entire size and down to the lowest stellar masses. Methods. We used both Gaia astrometric (proper motions and parallaxes) and photometric measurements (integrated photometry and colors) to select association members, using minimal assumptions derived mostly from the HIPPARCOS studies. Gaia resolves small details in both the kinematics of individual Sco OB2 subgroups and their distribution with distance from the Sun. We developed methods to explore the 3D kinematics of a stellar population covering large sky areas. Results. We find nearly 11 000 pre-main-sequence (PMS) members of Sco OB2 (with less than 3% field-star contamination), plus ∼3600 main-sequence (MS) candidate members with a larger (10–30%) field-star contamination. A higher confidence subsample of ∼9200 PMS (and ∼1340 MS) members is also selected (<1% contamination for the PMS), however this group is affected by larger (∼15%) incompleteness. We separately classify stars in compact and diffuse populations. Most members belong to one of several kinematically distinct diffuse populations, whose ensemble clearly outlines the shape of the entire association. Upper Sco is the densest region of Sco OB2. It is characterized by a complex spatial and kinematical structure and has no global pattern of motion. Other dense subclusters are found in Lower Centaurus-Crux and in Upper Centaurus-Lupus; the richest example of the latter, which has been recently identified, is coincident with the group near V1062 Sco. Most of the clustered stars appear to be younger than the diffuse PMS population, suggesting star formation in small groups that rapidly disperse and are diluted, reaching space densities lower than field stars while keeping memory of their original kinematics. We also find that the open cluster IC 2602 has a similar dynamics to Sco OB2, and its PMS members are currently evaporating and forming a diffuse (size ∼10°) halo around its double-peaked core.