  We introduce the notions of Hopf quasigroup and Hopf coquasigroup $H$
generalising the classical notion of an inverse property quasigroup $G$
expressed respectively as a quasigroup algebra $k G$ and an algebraic
quasigroup $k[G]$. We prove basic results as for Hopf algebras, such as
anti(co)multiplicativity of the antipode $S:H\to H$, that $S^2=\id$ if $H$ is
commutative or cocommutative, and a theory of crossed (co)products. We also
introduce the notion of a Moufang Hopf (co)quasigroup and show that the
coordinate algebras $k[S^{2^n-1}]$ of the parallelizable spheres are algebraic
quasigroups (commutative Hopf coquasigroups in our formulation) and Moufang. We
make use of the description of composition algebras such as the octonions via a
cochain $F$ introduced in \cite{Ma99}. We construct an example
$k[S^7]\rtimes\Z_2^3$ of a Hopf coquasigroup which is noncommutative and
non-trivially Moufang. We use Hopf coquasigroup methods to study differential
geometry on $k[S^7]$ including a short algebraic proof that $S^7$ is
parallelizable. Looking at combinations of left and right invariant vector
fields on $k[S^7]$ we provide a new description of the structure constants of
the Lie algebra $g_2$ in terms of the structure constants $F$ of the octonions.
In the concluding section we give a new description of the $q$-deformation
quantum group $\C_q[S^3]$ regarded trivially as a Moufang Hopf coquasigroup
(trivially since it is in fact a Hopf algebra) but now in terms of $F$ built up
via the Cayley-Dickson process.
