For a triple $(G,A,\kappa)$ (where $G$ is a group, $A$ is a $G$-module and
$\kappa:G^3\to A$ is a 3-cocycle) and a $G$-module $B$ we introduce a new
cohomology theory $_2H^n(G,A,\kappa;B)$ which we call the secondary cohomology.
We give a construction that associates to a pointed topological space $(X,x_0)$
an invariant $_2\kappa^4\in_2H^4(\pi_1(X),\pi_2(X),\kappa^3;\pi_3(X))$. This
construction can be seen a "3-type" generalization of the classical
$k$-invariant.