5. If $x, y, z$ are all positive real numbers, and $x^{2}+y^{2}+z^{2}=1$, then the minimum value of $S=\frac{(z+1)^{2}}{2 x y z}$ is $\qquad$ .
$5.5+2 \sqrt{2}$. 
Since $2 x y \leqslant x^{2}+y^{2}=1-z^{2}$, we have,
$$
\begin{aligned}
S & =\frac{(z+1)^{2}}{2 x y z} \geqslant \frac{(z+1)^{2}}{z\left(1-z^{2}\right)} \\
& =\frac{z+1}{(1-z) z}=\frac{z+1}{[2-(z+1)][(z+1)-1]} \\
& =\frac{1}{3-\left[(z+1)+\frac{2}{z+1}\right]} \\
& \geqslant \frac{1}{3-2 \sqrt{2}}=3+2 \sqrt{2} .
\end{aligned}
$$

The equality holds if and only if $z=\sqrt{2}-1, x=y=\sqrt{\sqrt{2}-1}$.