Context. Knowledge of the distance to high-mass star forming regions is crucial to obtain accurate luminosity and mass estimates of young OB-type (proto)stars and thus better constrain their nature and age. IRAS 20126+4104 is a special case, being the best candidate of a high-mass (proto)star surrounded by an accretion disk. Such a fact may be used to set constraints on theories of highmass star formation, but requires confirmation that the mass and luminosity of IRAS 20126+4104 are indeed typical of a B0.5 star, which in turn requires an accurate estimate of the distance. Aims. The goal of our study is twofold: to determine the distance to IRAS 20126+4104, using the parallax of H 2 O masers associated with the source, and unveil the 3D velocity field of the disk, through proper motion measurements of the 6.7 GHz CH 3 OH masers. At the same time, we can also obtain an estimate of the systemic velocity in the plane of the sky of the disk+star system. Methods. We used the Very Long Baseline Array and the European VLBI Network to observe the 22.2 GHz H 2 O and 6.7 GHz CH 3 OH masers in IRAS 20126+4104 at a number of epochs suitably distributed in time. The absolute positions of the maser features were established with respect to reference quasars, which allowed us to derive absolute proper motions. Results. From the parallax of the H 2 O masers we obtain a distance of 1.64 ± 0.05 kpc, which is very similar to the value adopted so far in the literature (1.7 kpc) and confirms that IRAS 20126+4104 is a high-mass (proto)star. From the CH 3 OH masers we derive the component in the plane of the sky of the systemic velocity of the disk+star system (−16 km s −1 in right-ascension and +7.6 km s −1 in declination). Accurate knowledge of the distance and systemic velocity allows us to improve on the model fit to the H 2 O maser jet presented in a previous study. Finally, we identify two groups of CH 3 OH maser features, one undergoing rotation in the disk and possibly distributed along a narrow ring centered on the star, the other characterised by relative proper motions indicating that the features are moving away from the disk, perpendicular to it. We speculate that the latter group might be tracing the disk material marginally entrained by the jet. Conclusions. VLBI multi-epoch observations with phase referencing are confirmed to be an excellent tool for distance determinations and for the investigation of the structure and 3D velocity field within a few 100 AU from newly born high-mass stars.