Plate tectonics is a fundamental component for the habitability of the Earth. Yet whether it is a recurrent feature of terrestrial bodies orbiting other stars or unique to the Earth is unknown. The stagnant lid may rather be the most common tectonic expression on such bodies. To understand whether a stagnant-lid planet can be habitable, i.e. host liquid water at its surface, we model the thermal evolution of the mantle, volcanic outgassing of H$_2$O and CO$_2$, and resulting climate of an Earth-like planet lacking plate tectonics. We used a 1D model of parameterized convection to simulate the evolution of melt generation and the build-up of an atmosphere of H$_2$O and CO$_2$ over 4.5 Gyr. We then employed a 1D radiative-convective atmosphere model to calculate the global mean atmospheric temperature and the boundaries of the habitable zone (HZ). The evolution of the interior is characterized by the initial production of a large amount of partial melt accompanied by a rapid outgassing of H$_2$O and CO$_2$. At 1 au, the obtained temperatures generally allow for liquid water on the surface nearly over the entire evolution. While the outer edge of the HZ is mostly influenced by the amount of outgassed CO$_2$, the inner edge presents a more complex behaviour that is dependent on the partial pressures of both gases. At 1 au, the stagnant-lid planet considered would be regarded as habitable. The width of the HZ at the end of the evolution, albeit influenced by the amount of outgassed CO$_2$, can vary in a non-monotonic way depending on the extent of the outgassed H$_2$O reservoir. Our results suggest that stagnant-lid planets can be habitable over geological timescales and that joint modelling of interior evolution, volcanic outgassing, and accompanying climate is necessary to robustly characterize planetary habitability.