Water vapour absorbs the thermal radiation (heat trying to escape earth) better than it absorbs sunlight (heat trying to enter earth). Therefore, the more water vapour in the atmosphere, the stronger the greenhouse effect.
https://en.wikipedia.org/wiki/Electromagnetic_absorption_by_...