We have studied the effect of nonequilibrium longitudinal optical phonons on hot-electron spin relaxation in n-type GaAs quantum wells. The longitudinal optical phonons, due to the finite relaxation rate, are driven to nonequilibrium states by electrons under an in-plane electric field. The nonequilibrium phonons then in turn influence the electron spin relaxation properties via modifying the electron heating and drifting. The spin relaxation time is elongated due to the enhanced electron heating and thus the electron-phonon scattering in the presence of nonequilibrium phonons. The frequency of spin precession, which is roughly proportional to the electron drift velocity, can be either increased (at low electric field and/or high lattice temperature) or decreased (at high electric field and/or low lattice temperature). The nonequilibrium phonon effect is more pronounced when the electron density is high and the impurity density is low.