For closed and connected subgroups G of SO(n), we study the energy functional on the space of G-structures of a (compact) Riemannian manifold (M, 〈⋅, ⋅〉), where G-structures are considered as sections of the quotient bundle (M)/G. We deduce the corresponding first and second variation formulae and the characterising conditions for critical points by means of tools closely related to the study of G-structures. In this direction, we show the rôle in the energy functional played by the intrinsic torsion of the G-structure. Moreover, we analyse the particular case G=U(n) for 2n-dimensional manifolds. This leads to the study of harmonic almost Hermitian manifolds and harmonic maps from M into (M)/U(n).