Newton's generalization of Kepler's third law (derived below) can be used to measure the masses of stars in binary systems.
Observations of the mutual orbit then yield values for a and P (the orbital period). While these can be messy for close binaries or for binaries that are not well aligned along the line of site, there are enough decent binary systems nearby where secure measures of stellar mass can be obtained.