The degree to which a pure quantum state is entangled can be characterized by the distance or angle to the nearest unentangled state. This geometric measure of entanglement, already present in a number of settings (see Shimony 1995 and Barnum and Linden 2001), is explored for bipartite and multipartite pure and mixed states. The measure is determined analytically for arbitrary two-qubit mixed states and for generalized Werner and isotropic states, and is also applied to certain multipartite mixed states. In particular, a detailed analysis is given for arbitrary mixtures of three-qubit GHZ, W and inverted-W states. Along the way, we point out connections of the geometric measure of entanglement with entanglement witnesses and with the Hartree approximation method.