The Gerlach and Sengupta (GS) formalism of coordinate-invariant, first-order, spherical and nonspherical perturbations around an arbitrary spherical spacetime is generalized to higher orders, focusing on second-order perturbation theory. The GS harmonics are generalized to an arbitrary number of indices on the unit sphere and a formula is given for their products. The formalism is optimized for its implementation in a computer-algebra system, something that becomes essential in practice given the size and complexity of the equations. All evolution equations for the second-order perturbations, as well as the conservation equations for the energy-momentum tensor at this perturbation order, are given in covariant form, in Regge-Wheeler gauge.