The magnetic structure of a monolayer-thick GdAu2 surface alloy on Au(111) has been investigated down to the atomic level by spin-polarized scanning tunneling microscopy. Spin-resolved tunneling spectroscopy combined with density-functional theory calculations reveal the local spin polarization of both Gd and Au atomic sites within the surface alloy. Moreover, the impact of dislocation lines on the atomic-scale magnetic structure as well as on the local coercive field strength is demonstrated.