Spin resonance of single spin centers bears great potential for chemical structure analysis, quantum sensing, and quantum coherent manipulation. Essential for these experiments is the presence of a two-level spin system whose energy splitting can be chosen by applying a magnetic field. In recent years, a combination of electron spin resonance (ESR) and scanning tunneling microscopy (STM) has been demonstrated as a technique to detect magnetic properties of single atoms on surfaces and to achieve sub-microelectronvolts energy resolution. Nevertheless, up to now the role of the required magnetic fields has not been elucidated. Here, we perform single-atom ESR on individual Fe atoms adsorbed on magnesium oxide (MgO) using a two-dimensional vector magnetic field as well as the local field of the magnetic STM tip in a commercially available STM. We show how the ESR amplitude can be greatly improved by optimizing the magnetic fields, revealing in particular an enhanced signal at large in-plane magnetic fields. Moreover, we demonstrate that the stray field from the magnetic STM tip is a versatile tool. We use it here to drive the electron spin more efficiently and to perform ESR measurements at constant frequency by employing tip-field sweeps. Lastly, we show that it is possible to perform ESR using only the tip field, under zero external magnetic field, which promises to make this technique available in many existing STM systems.