Masses of W Ursae Majoris-type (W UMa) binaries play a critical role in investigating stellar dynamical evolutionary status. In this paper, we combine the PARSEC (PAdova and TRieste Stellar Evolution Code) with the Roche geometric model to provide a method to determine the masses of W UMa systems. To verify the validity of this method, we compile a sample of 140 spectrum binaries from the literature, which includes 76 W- and 64 A-subtype systems with reliable physical parameters. We find that the average fractional difference and the standard deviation (σM) of the residuals for W-subtype and A-subtype approximately amount to 15.66% and 0.1218, 16.03% and 0.2094, respectively. Meanwhile, we also perform detailed analyses in accordance with the orbital period, the effective temperatures and the mass ratio. We find that the method is more applicable to determine masses for W UMa systems with low effective temperature and short period.