Motivated by recent spin- and angular-resolved photoemission (SARPES) measurements performed on the two-dimensional electronic states confined near the (001) surface of SrTiO$_3$ in the presence of oxygen vacancies, we explore their spin structure by means of ab initio density functional theory (DFT) calculations of slabs. Relativistic nonmagnetic DFT calculations display Rashba-like spin winding with a splitting of a few meV and when surface magnetism on the Ti ions is in- cluded, bands become spin-split with an energy difference ~100 meV at the $Gamma$ point, consistent with SARPES findings. While magnetism tends to suppress the effects of the relativistic Rashba interaction, signatures of it are still clearly visible in terms of complex spin textures. Furthermore, we observe an atomic specialization phenomenon, namely, two types of electronic contributions: one is from Ti atoms neighboring the oxygen vacancies that acquire rather large magnetic moments and mostly create in-gap states; another comes from the partly polarized t$_{2g}$ itinerant electrons of Ti atoms lying further away from the oxygen vacancy, which form the two-dimensional electron system and are responsible for the Rashba spin winding and the spin splitting at the Fermi surface.