During the first decade of the 1900s Henrietta Leavitt (1868 - 1921), working at the Harvard College Observatory, studying photographic plates of the Large (LMC) and Small (SMC) Magellanic Clouds, compiled a list of 1,777 periodic variables. Eventually she classified 47 of these in the two clouds as Cepheid variables and noticed that those with longer periods were brighter than the shorter-period ones. She correctly inferred that as the stars were in the same distant clouds they were all at much the same relative distance from us. Any difference in apparent magnitude was therefore related to a difference in absolute magnitude. When she plotted her results for the two clouds she noted that they formed distinct relationships between brightness and period.
Her plot showed what is now known as the period-luminosity relationship; cepheids with longer periods are intrinsically more luminous than those with shorter periods. The Danish astronomer, Ejnar Hertzsprung (1873-1967) quickly realised the significance of this discovery. By measuring the period of a Cepheid from its light curve, the distance to that Cepheid could be determined. He used his data on nearby Cepheids to calculate the distance to the Cepheids in the SMC as 37,000 light years away.
Harlow Shapley, an American astronomer using a larger number of Cepheids, recalibrated the absolute magnitude scale for Cepheids and revised the value of the distance to the SMC to 95,000 light years. He also studied Cepheids in 86 globular clusters and found that the few dozen brightest non-variable stars in each cluster was about 10 × brighter than the average Cepheid. From this he could infer the distance to globular cluster too distant to have visible Cepheids and realised that these clusters were all essentially the same size and luminosity. By mapping the distribution and distance of globular clusters he was able to deduce the size of our galaxy, the Milky Way .
In 1924 Edwin Hubble detected Cepheids in the Andromeda nebula, M31 and the Triangulum nebula M33. Using these he determined that their distances were 900,000 and 850,000 light years respectively. He thus established conclusively that these "spiral nebulae" were in fact other galaxies and not part of our Milky Way. This was a momentous discovery and dramatically expanded the scale of he known Universe. Hubble later went on to observe the redshift of galaxies and propose that this was due to their recession velocity, with more distant galaxies moving away at a higher speed than nearby ones. This relationship is now called Hubble's Law and is interpreted to mean that the Universe is expanding.
More information about Cepheid Variable Stars in this link .