Consider an electron bounded to an hydrogen like atom and take a strong external field $B$ along the $\hat{z}$ direction, it has orbital magnetic moment $\vec{M_{L}}$ and intrinsic magnetic moment $\vec{M_{S}}$ given by
$$\vec{M_{L}}=\frac{\mu_{B}\vec{L}}{\hbar} \hspace{1.5 cm} \vec{M_{S}}=g\frac{\mu_{B}\vec{S}}{\hbar}$$
and the hamiltonian will be given by
$$H=-\frac{\hbar^2}{2m}\nabla^2-\frac{Ze^2}{4\pi\epsilon_{0}r}+\frac{\mu_{B}B}{\hbar}(L_{z}+gS_{z})$$
the determination of the gyromagnetic factor $g$ is crucial since the splitting of the energy levels strictly depends on it:
$$E=E_{n}+\mu_{B}B(m_{l}+gm_{s})$$
In order to determine the $g$ factor we can for example make a Stern-Gerlach experiment along $\vec{z}$ direction with Ag atoms prepared in a $|S_{x}\rangle$ (or also $|S_{y}\rangle$). If you put another Stern-Gerlach device with magnetic field along $\hat{x}$ (or $\hat{y}$) at the end of the one along $\vec{z}$ direction, you can take note of the number of electrons found in one of these two states $|S_{x}\rangle$ state and $|S_{y}\rangle$ state. At a given time $t$ the probabilities are
$$P(|S_{y}\rangle)=\cos^2\left(\frac{\omega_L t}{2}\right) \hspace{1.5 cm} P(|S_{y}\rangle)=\sin^2\left(\frac{\omega_L t}{2}\right)$$
with $\omega_{L}$ (Larmor frequency) given by $g \frac{\mu_{B}}{\hbar} B$. You can make a fit for the frequency and determine $g$. By this type of experiment we know that $g=2$.
If we now return to the problem of the electron in a strong field and we consider the selection rules for dipole transition ($\Delta m_{l}=0,-1,+1$ and $\Delta m_{s}=0$), we note that the spectral line corresponding to a transition from n to n' energy levels is split into three components, each of those separated by the Larmor frequency, the same frequency we found in the spin's precession.