The first method for measuring distance to a star is using a parallax , i.e triangulation.It's a method in which the change in position of a celestial body caused by the motion of the earth with respect to an observer on earth along with a little trigonometry is used to determine the distance .
Another method is to use standard candles .A standard candle is a class of astrophysical objects, such as supernovae or variable stars, which have known luminosity due to some characteristic quality possessed by the entire class of objects.Thus comparing the standard candles with other astronomical objects;we are able measure huge distances.To find out more on how spectrum of stars tell us about them click here.