  We consider a (pseudo)Riemannian manifold of arbitrary dimension. The
Hamilton-Jacobi equation for geodesic Hamiltonian admits complete separation of
variables for some (separable) metrics in some (separable) coordinate systems.
Separable metrics are very important in mathematics and physics. The St\"ackel
problem is: ``Which metrics admit complete separation of variables in the
geodesic Hamilton-Jacobi equation?'' This problem was solved for inverse
metrics with nonzero diagonal elements, in particular, for positive definite
Riemannian metrics long ago. However the question is open for indefinite
metrics having zeroes on diagonals. We propose the solution. Separable metrics
are divided into equivalence classes characterised by the number of commuting
Killing vector fields, quadratic indecomposable conservation laws for
geodesics, and the number of coisotropic coordinates. The paper contains
detailed proofs, sometimes new, of previous results as well as new cases. As an
example, we list all canonical separable metrics in each equivalence class in
two, three, and four dimensions. Thus the St\"ackel problem is completely
solved for metrics of any signature in any number of dimensions.
