The Smooth-Particle-Hydrodynamics (SPH) method is derived in a novel manner by means of a Galerkin approximation applied to the Lagrangian equations of continuum mechanics as in the finite-element method. This derivation is modified to replace the SPH interpolant with the Moving-Least-Squares (MLS) interpolant of Lancaster and Saulkaskas, and define a new particle volume which ensures thermodynamic compatibility. A variable-rank modification of the MLS interpolants which retains their desirable summation properties is introduced to remove the singularities that occur when divergent flow reduces the number of neighbours of a particle to less than the minimum required. A surprise benefit of the Galerkin SPH derivation is a theoretical justification of a common ad hoc technique for variable-h SPH. The new MLSPH method is conservative if an anti-symmetric quadrature rule for the stiffness matrix elements can be supplied. In this paper, a simple one-point collocation rule is used to retain similarity with SPH, leading to a non-conservative method. Several examples document how MLSPH renders dramatic improvements due to the linear consistency of its gradients on three canonical difficulties of the SPH method: spurious boundary effects, erroneous rates of strain and rotation and tension instability. Two of these examples are non-linear Lagrangian patch tests with analytic solutions with which MLSPH agrees almost exactly. The examples also show that MLSPH is not absolutely stable if the problems are run to very long times. A linear stability analysis explains both why it is more stable than SPH and not yet absolutely stable and an argument is made that for realistic dynamic problems MLSPH is stable enough. The notion of coherent particles, for which the numerical stability is identical to the physical stability, is introduced. The new method is easily retrofitted into a generic SPH code and some observations on performance are made. Copyright © 1999 John Wiley & Sons, Ltd.