The answer is lattice energy. The enthalpies involved in the formation of ionic compounds can be understood by Born-Haber cycle. The following steps are involved in the formation of $\ce{NaCl}$ for example. $$\ce {Na(s) -> Na(g)}\tag{1}$$ $$\ce{Na(g) -> Na+ + e-}\tag{2}$$ $$\ce{1/2 Cl2(g) -> Cl(g)}\tag{3}$$ $$\ce{Cl(g) + e- -> Cl^{-}(g)}\tag{4}$$ $$\ce{Na+(g) +Cl^{-}(g) -> NaCl(s)}\tag{5}$$ You can see that energy is required in the steps 1-3 whereas energy is evolved in 4th and 5th steps. The energy evolved in the 5th step is called the lattice energy of the ionic compound and this only is responsible for the overall process being exothermic.