  We study an energy functional on the universal spinor bundle over a closed
$n$-dimensional spin manifold $M$. The critical points of this functional,
which is modelled on the total torsion functional of $G_2$-structures in seven
dimensions, are pairs of Ricci-flat metrics and real parallel spinor fields
provided that $n$ equals $3$ or $7$. We then modify the functional to obtain
the analogue in arbitrary dimensions. Finally we apply the universal spinor
bundle approach to solve some ODEs problems concerning $G_2$-structures.
