5. Given that the function $f(x)$ is a monotonic function, and for $x \in$ $(0,+\infty)$, we have $f\left(f(x)+\frac{2}{x}\right)=1$. Then $f(1)=$ ( ).
(A) -3
(B) -2
(C) -1
(D) 0
5. D.

Let $f(x)+\frac{2}{x}=k$ (where $k$ is a constant).
$$
\begin{array}{l}
\text { Given } f\left(f(x)+\frac{2}{x}\right)=f(k)=1 \\
\Rightarrow f(x)+\frac{2}{x}=k \Rightarrow f(x)=k-\frac{2}{x} \\
\Rightarrow f(k)=k-\frac{2}{k}=1 .
\end{array}
$$

Given $x \in(0,+\infty)$, solving yields $k=2$.
Thus, $f(x)=2-\frac{2}{x}$.
Therefore, $f(1)=2-\frac{2}{1}=0$.