Abu Hurairah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "While a man was walking on his way he became extremely thirsty. He found a well, he went down into it to drink water. Upon leaving it, he saw a dog which was panting out of thirst. His tongue was lolling out and he was eating moist earth from extreme thirst. The man thought to himself: 'This dog is extremely thirsty as I was.' So he descended into the well, filled up his leather sock with water, and holding it in his teeth, climbed up and quenched the thirst of the dog. Allah appreciated his action and forgave his sins". The Companions asked: "Shall we be rewarded for showing kindness to the animals also?" He (ﷺ) said, "A reward is given in connection with every living creature".[Al-Bukhari and Muslim].In the narration of Al-Bukhari, the Prophet (ﷺ) is reported to have said: "Allah forgave him in appreciation of this act and admitted him to Jannah".Another narration says: "Once a dog was going round the well and was about to die out of thirst. A prostitute of Banu Israel happened to see it. So she took off her leather sock and lowered it into the well. She drew out some water and gave the dog to drink. She was forgiven on account of her action".
Arabic/English book reference: Book 1, Hadith 126