$\newcommand{\Reals}{\mathbf{R}}\newcommand{\grad}{\nabla}$Let $f$ and $g$ be continuously-differentiable real-valued functions on $\Reals^{3}$, and assume $\grad g$ is non-vanishing on the (non-empty) level set $\{g = 0\}$, so that $M = \{g = 0\}$ is a smooth surface by the implicit function theorem.
The Lagrange multipliers equation
$$
\grad f = \lambda \grad g
\tag{1}
$$
is the critical point condition for $f$ on $M$. As you say, this is necessary in order that $f$ have an extremum, but it is not generally sufficient, as you suspect.
To give a simple example, if $g(x, y, z) = z$, then $M = \{g = 0\}$ is the $(x, y)$-plane, and a solution of (1) is precisely a critical point of the function $\phi(x, y) = f(x, y, 0)$. It's easy to cook up functions $f$ so that $\phi$ has no extrema (say, $f(x, y, z) = x^{2} - y^{2}$), or has absolute extrema but also critical points that are not absolute extrema.
If $M$ is compact, i.e., closed and bounded, then the extreme value theorem guarantees that $f$ achieves an absolute minimum and an absolute maximum on $M$. Nonetheless, $f$ can still have critical points on $M$ that are not extrema. The prototypical example is perhaps to pick real numbers $a < b < c$, and to consider
$$
f(x, y, z) = ax^{2} + by^{2} + cz^{2},\quad
g(x, y, z) = x^{2} + y^{2} + z^{2} - 1.
$$
The solutions of (1) are easily checked to be the standard basis vectors and their negatives; the absolute minima of $f$ occur at $\pm(1, 0, 0)$, the absolute maxima at $\pm(0, 0, 1)$. The points $\pm(0, 1, 0)$ are non-extremal critical points.