In the case of DC-driven inductive loads, such as mechanical relays, solenoids, and DC motors, a diode placed across the inductor will reduce the spike ..
In AC circuits the answer is resistor-capacitor “snubber” circuits .. see picture below ..
The snubber prevents arcing and burning of the relay contacts ..
The selection of optimum resistor and capacitor values is often a matter of trial and error, but the values shown in the Table2 are good as a starting point ..
Regards,
IanP