Many-body interactions between carriers lie at the heart of correlated physics. The ability to tune such interactions would allow the possibility to access and control complex electronic phase diagrams. Recently, two-dimensional moiré superlattices have emerged as a promising platform for quantum engineering such phenomena1-3. The power of the moiré system lies in the high tunability of its physical parameters by adjusting the layer twist angle1-3, electrical field4-6, moiré carrier filling7-11 and interlayer coupling12. Here we report that optical excitation can highly tune the spin-spin interactions between moiré-trapped carriers, resulting in ferromagnetic order in WS2 /WSe2 moiré superlattices. Near the filling factor of -1/3 (that is, one hole per three moiré unit cells), as the excitation power at the exciton resonance increases, a well-developed hysteresis loop emerges in the reflective magnetic circular dichroism signal as a function of magnetic field, a hallmark of ferromagnetism. The hysteresis loop persists down to charge neutrality, and its shape evolves as the moiré superlattice is gradually filled, indicating changes of magnetic ground state properties. The observed phenomenon points to a mechanism in which itinerant photoexcited excitons mediate exchange coupling between moiré-trapped holes. This exciton-mediated interaction can be of longer range than direct coupling between moiré-trapped holes9, and thus magnetic order arises even in the dilute hole regime. This discovery adds a dynamic tuning knob to the rich many-body Hamiltonian of moiré quantum matter13-19.