5. If the equation $a^{x}=\log _{a} x(a>1)$ has a unique solution with respect to $x$, then $a=$
5. $\mathrm{e}^{\frac{1}{e}}$.

As shown in Figure 2, let's observe the graphs of the functions $y=a^{x}$ and $y=\log _{a} x$. Since these two functions are inverses of each other, the points where they are equal lie on the line $y=x$. If the equation $a^{x}=\log _{a} x$ has a unique solution $x_{0}$, then $a^{x_{0}}=x_{0}$, and for $x \neq x_{0}$, we have $a^{x} \geqslant x$.

Consider the function $f(x)=a^{x}-x$. We have $f\left(x_{0}\right)=0$. Since $x_{0}$ is the minimum point of this function, we also have $f^{\prime}\left(x_{0}\right)=0$, which gives us $a^{x_{0}}=x_{0}$ and $a^{x_{0}} \ln a-1=0$. This implies $x_{0} \ln a=1, x_{0}=\frac{1}{\ln a}$. This indicates
$$
a^{\frac{1}{\ln a}}=\frac{1}{\ln a} \Rightarrow \mathrm{e}=\frac{1}{\ln a} \Rightarrow \ln a=\frac{1}{\mathrm{e}} \Rightarrow a=\mathrm{e}^{\frac{1}{e}} .
$$

Now let's verify that the obtained value of $a$ satisfies the conditions in the problem. In fact, for such a value of $a$, the original equation takes the form $\mathrm{e}^{\frac{x}{e}}=\mathrm{e} \ln x$, which has the solution $x=\mathrm{e}$. There are no other solutions, as
$$
f^{\prime}(x)=\left\{\begin{array}{ll}
\frac{1}{\mathrm{e}} \mathrm{e}^{\frac{x}{e}}-1>0, & x>\mathrm{e}, \\
\frac{1}{\mathrm{e}} \mathrm{e}^{\frac{x}{e}}-1<0, & x<\mathrm{e}.
\end{array}\right.
$$
Thus, $x=\mathrm{e}$ is the unique solution to the equation $f(x)=0$.