How did Edwin Hubble confirm in the 1920s that spiral nebulae were 'island universes'?

Answer

By identifying Cepheid variable stars within the Andromeda Nebula (M31) and calculating its distance

Hubble identified Cepheid variable stars in M31, and by measuring their period-luminosity relationship, he calculated a distance placing M31 far outside the Milky Way.

How did Edwin Hubble confirm in the 1920s that spiral nebulae were 'island universes'?
discoveryastronomynebulae