Abstract. The 2-twist spun trefoil is an example of a sphere that is knotted in 4-dimensional space. A proof is given in this paper that this sphere is distinct from the same sphere with its orientation reversed. Our proof is based on a state-sum invariant for knotted surfaces developed via a cohomology theory of racks and quandles (also known as distributive groupoids).A quandle is a set with a binary operation -the axioms of which model the Reidemeister moves in classical knot theory. Colorings of diagrams of knotted curves and surfaces by quandle elements, together with cocycles of quandles, are used to define state-sum invariants for knotted circles in 3-space and knotted surfaces in 4-space.Cohomology groups of various quandles are computed herein and applied to the study of the state-sum invariants. Non-triviality of the invariants is proved for a variety of knots and links, and conversely, knot invariants are used to prove non-triviality of cohomology for a variety of quandles.