We describe all almost contact metric, almost hermitian and G 2-structures admitting a connection with totally skew-symmetric torsion tensor, and prove that there exists at most one such connection. We investigate its torsion form, its Ricci tensor, the Dirac operator and the ∇-parallel spinors. In particular, we obtain solutions of the type II string equations in dimension n = 5, 6 and 7.