We study g-valued Yang-Mills fields on cylinders Z(G/H) = R × G/H, where G/H is a compact seven-dimensional coset space with G 2 -structure, g is the Lie algebra of G, and Z(G/H) inherits a Spin(7)-structure. After imposing a general G-invariance condition, Yang-Mills theory with torsion on Z(G/H) reduces to Newtonian mechanics of a point particle moving in R n under the influence of some quartic potential and possibly additional constraints. The kinematics and dynamics depends on the chosen coset space. We consider in detail three coset spaces with nearly parallel G 2 -structure and four coset spaces with SU (3)-structure. For each case, we analyze the critical points of the potential and present a range of finite-energy solutions. We also study a higher-dimensional analog of the instanton equation. Its solutions yield G-invariant Spin(7)-instanton configurations on Z(G/H), which are special cases of Yang-Mills configurations with torsion.