We present an investigation of the effects of asphericity on the estimates of total mass and gas mass fraction in galaxy clusters from X-ray observations. We model the aspherical shape of galaxy clusters by a triaxial model and compare the true total mass and the true total gas mass fraction with the corresponding quantities obtained with the assumption of spherical symmetry. In the triaxial model we allow the extent along the line of sight to vary in order to describe elongated and compressed cluster shapes. Using a sample of 10 ROSAT clusters and a recent CHANDRA observation we find the following results. For prolate or oblate shapes the difference between triaxial and spherical model both in the mass and in the gas mass fraction are negligible (less than 3 %). For more aspherical shapes the total mass is underestimated (overestimated) in the centre, if the cluster is compressed (elongated). The gas mass fraction is overestimated for compressed clusters and slightly underestimated for elongated clusters. Comparing X-ray masses with gravitational lensing estimates, we find that elongations along the line of sight can resolve discrepancies of masses determined by the two different methods of up to ~30 %. The combination of Sunyaev-Zeldovich and X-ray observations is useful to measure the elongation of the cluster along the line of sight. As an application, we estimate the elongation of the cluster CL0016+16 with two different approaches, Sunyaev-Zeldovich measurements and comparison of weak lensing and X-ray masses, and find reasonable agreement.