If clusters of galaxies are self-similar and the intracluster gas is in global quasiequilibrium with the dark matter, a tight relation between mass and X-ray temperature is expected in most cosmological models. We here calibrate this relation using 8 clusters with well-defined global temperatures measured with ASCA and masses inferred from gravitational lensing. The surface lensing masses are deprojected in accordance with N-body simulations and analytic results. The data are well-fitted by the theoretical mass-temperature relation and are consistent with the empirical normalisation found in gasdynamic simulations. As there is no discrepancy between the lensing and X-ray derived masses this approach could lead to a powerful and expedient way of measuring masses of clusters of galaxies. Constraints on N( z) and Λ can also be obtained by studying high-redshift cluster lenses.