Why is spin quantum number introduced?

When we observe spectrum of yellow light by using high resolution spectroscope it has very closely spaced doublet. Similar patterns are shown by Alkali and Alkaline earth metals. In order to account this, spin quantum number is introduced.