Context. Nonthermal radio emission in massive stars is expected to arise in wind-wind collisions occurring inside a binary system. One such case, the O-type star Cyg OB2 #9, was proven to be a binary only four years ago, but the orbital parameters remained uncertain. The periastron passage of 2011 was the first one to be observable under good conditions since the discovery of binarity. Aims. In this context, we have organized a large monitoring campaign to refine the orbital solution and to study the wind-wind collision.Methods. This paper presents the analysis of optical spectroscopic data, as well as of a dedicated X-ray monitoring performed with Swift and XMM-Newton. Results. In light of our refined orbital solution, Cyg OB2 #9 appears as a massive O+O binary with a long period and high eccentricity; its components (O5-5.5I for the primary and O3-4III for the secondary) have similar masses and similar luminosities. The new data also provide the first evidence that a wind-wind collision is present in the system. In the optical domain, the broad Hα line varies, displaying enhanced absorption and emission components at periastron. X-ray observations yield the unambiguous signature of an adiabatic collision, because as the stars approach periastron, the X-ray luminosity closely follows the 1/D variation expected in that case. The X-ray spectrum appears, however, slightly softer at periastron, which is probably related to winds colliding at slightly lower speeds at that time. Conclusions. It is the first time that such a variation has been detected in O+O systems, and the first case where the wind-wind collision is found to remain adiabatic even at periastron passage.