IRAS 20126+4104 is one of the best candidates for a high-mass (proto)star surrounded by an accretion disk. Such a fact may be used to set constraints on theories of high-mass 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. We used the Very Long Baseline Array and the European VLBI Network to observe the 22.2 GHz water and 6.7 GHz methanol 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. From the parallax of the water masers we obtain a distance of 1.64 \pm 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 methanol masers we derive the component in the plane of the sky of the systemic velocity of the disk+star system (-16 km/s in right-ascension and +7.6 km/s in declination). Accurate knowledge of the distance and systemic velocity allows us to improve on the model fit to the water maser jet presented in a previous study. Finally, we identify two groups of methanol 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.