Ground state energy in terms of partition function

I've read that considering a quantum system with Hamiltonian $H$ and propagator

$$K(x,t;x',t')=\langle x|U(t,t')|x'\rangle$$

if we define

$$Z=\int d^3x' K(x',-i\hbar\beta;x',0)$$

then the fundamental state energy can be derived from $Z$ as

$$E=\lim_{\beta\to \infty}-\dfrac{1}{Z}\dfrac{\partial Z}{\partial \beta}$$

I've tried to show this in the following way: if we use time-independent $H$ we can write $U(t,t')=e^{-iH(t-t')/\hbar}$. Thus we have by the definitions

$$Z=\int d^3 x' \langle x'|e^{-\beta H}|x'\rangle,$$

thus if $|\varphi_n\rangle$ are the eigenstates of $H$ with eigenvalues $E_n$ we have

$$Z=\int d^3 x'\langle x'|e^{-\beta H}|x'\rangle=\sum_{n} \int d^3 x'\langle x'|\varphi_n\rangle \langle \varphi_n | e^{-\beta H}|x'\rangle=\sum_n \int d^3 x' e^{-\beta E_n}|\langle x'|\varphi_n\rangle|^2$$

in other words, assuming the basis of $H$ to be normalized

$$Z=\sum_n e^{-\beta E_n}$$

thus we can find

$$\dfrac{\partial Z}{\partial \beta}=-\sum_n E_n e^{-\beta E_n}$$

That is all fine, but how from this we can conclude that the ground state energy is that limit? It should be the smalest energy, but then what? I'm really not getting it.

It might well not be evident you are all but overthinking it. The seat-of-the-pants argument is $$K(x,t;x',0)= \langle x|e^{-itH/\hbar}|x'\rangle= \sum_a \langle x|e^{-itH/\hbar}| a\rangle \langle a|x'\rangle = \sum_a \langle x| a\rangle e^{-itE_a/\hbar} \langle a|x'\rangle,$$ where a complete set of eigenstates labelled by a has been inserted as a resolution of the identity. Normalize the eigenvalues to be non-negative, and denote that of the unique ground state by $E_0$.
Since $$Z=\int d^3 x ~ \sum_a \langle a|x\rangle\langle x|a\rangle ~ e^{-\beta E_a},$$ it is evident that this partition function for large real positive β is dominated by the largest exponential, that with the smallest unique eigenvalue $E_0$ in the exponent, so $$-\frac{1}{Z} \frac{\partial Z}{\partial \beta} =\frac{\sum_a E_a e^{-\beta E_a}}{Z} =\langle E \rangle$$ is dominated by $E_0$.
The ensemble average for the energy $\langle E\rangle$ at low temperature is dominated by the ground state.
Starting from $$Z=\sum_n e^{-\beta E_n} ,$$ one gets $$-\frac{1}{Z}\frac{\partial Z}{\partial \beta}=\frac{\sum_n E_n e^{-\beta E_n}}{\sum_m e^{-\beta E_m}},\\ =\frac{\sum_n E_n e^{-\beta (E_n-E_0)}}{\sum_m e^{-\beta (E_m-E_0)}},\\ =\frac{E_0}{1+\sum_{m>0} e^{-\beta (E_m-E_0)}}+\frac{\sum_{n>0} E_n e^{-\beta (E_n-E_0)}}{1+\sum_{m>0} e^{-\beta (E_m-E_0)}}.$$ Thus, in the limit $\beta\to\infty$, the denominator converges to 1, while the second term is exponentially suppressed and we obtain the thought for formula.