5. Let $x, y, z \in \mathbf{R}_{+}$, satisfying $x+y+z=x y z$. Then the function
$$
\begin{array}{l}
f(x, y, z) \\
=x^{2}(y z-1)+y^{2}(z x-1)+z^{2}(x y-1)
\end{array}
$$

has the minimum value of $\qquad$
5. 18 .

According to the conditions, we have
$$
y+z=x(y z-1) \Rightarrow y z-1=\frac{y+z}{x} \text{. }
$$

Similarly, $z x-1=\frac{z+x}{y}, x y-1=\frac{x+y}{z}$.
From $x y z=x+y+z \geqslant 3 \sqrt[3]{x y z} \Rightarrow x y z \geqslant 3 \sqrt{3}$, thus
$$
\begin{array}{l}
f(x, y, z)=2(x y+y z+z x) \\
\geqslant 2 \times 3 \sqrt[3]{(x y z)^{2}} \geqslant 18,
\end{array}
$$

When $x=y=z=\sqrt{3}$, the equality holds.