Muwatta Malik, Book 49, Hadith 23 (USC-MSA)

Yahya related to me from Malik from Sumayy, the mawla of Abu Bakr from Abu Salih as-Samman from Abu Hurayra that the Messenger of Allah, may Allah bless him and grant him peace, said, "A man was walking on a road when he became very thirsty. He found a well and went into it and drank and came out. There was a dog panting and eating earth out of thirst. The man said, 'This dog has become as thirsty as I was.' He went down into the well and filled his shoe and then held it in his mouth until he climbed out and gave the dog water to drink. Allah thanked him for it and forgave him." They said, "Messenger of Allah, do we have a reward for taking care of beasts?" He said, "There is a reward for every one with a moist liver."

وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ سُمَىٍّ، مَوْلَى أَبِي بَكْرٍ عَنْ أَبِي صَالِحٍ السَّمَّانِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ بَيْنَمَا رَجُلٌ يَمْشِي بِطَرِيقٍ إِذِ اشْتَدَّ عَلَيْهِ الْعَطَشُ فَوَجَدَ بِئْرًا فَنَزَلَ فِيهَا فَشَرِبَ وَخَرَجَ فَإِذَا كَلْبٌ يَلْهَثُ يَأْكُلُ الثَّرَى مِنَ الْعَطَشِ فَقَالَ الرَّجُلُ لَقَدْ بَلَغَ هَذَا الْكَلْبَ مِنَ الْعَطَشِ مِثْلُ الَّذِي بَلَغَ مِنِّي فَنَزَلَ الْبِئْرَ فَمَلأَ خُفَّهُ ثُمَّ أَمْسَكَهُ بِفِيهِ حَتَّى رَقِيَ فَسَقَى الْكَلْبَ فَشَكَرَ اللَّهُ لَهُ فَغَفَرَ لَهُ ‏"‏ ‏.‏ فَقَالُوا يَا رَسُولَ اللَّهِ وَإِنَّ لَنَا فِي الْبَهَائِمِ لأَجْرًا فَقَالَ ‏"‏ فِي كُلِّ ذَاتِ كَبِدٍ رَطْبَةٍ أَجْرٌ ‏"‏ ‏.‏

sunnah.com

also referenced under: Book 49, Hadith 1696 (In-Book)