We investigated spin-1/2 hydrogenated titanium (Ti) atoms on MgO using scanning tunneling microscopy (STM) combined with electron spin resonance (ESR) in vector magnetic fields. Rotating external magnetic fields, we observed rather drastic changes in both amplitude and frequency of resonance signals for single Ti atoms. While the variation of ESR amplitudes reflects the effects of the spin polarization of a magnetic tip and local magnetic fields created by the interaction between the tip and Ti, the change of resonance frequencies shows the anisotropy of g values for Ti atoms. Using the Ti atoms at the low-symmetry bridge adsorption site of the MgO lattice allowed for identifying the g values in all three spatial directions. Multiplet calculations confirmed the origin of this anisotropy as the spin-orbit coupling induced effects of crystal. Our results show the capability of single atomic spins as a sensor to probe magnetic surroundings and highlight the precision of ESR-STM to identify the single atom's spin states in a solid-state environment.