Hadith 254

Abu Huraira reported God’s messenger as saying, “Among the actions and good deeds for which a believer will continue to receive reward after his death are knowledge which he taught and spread, a good son whom he left behind, or a copy of the Qur'an which he left as a legacy, or a mosque which he built, or a house which he built for the traveller, or a stream which he caused to flow, or a sadaqa which he gave from his property when he was alive and well, for which he will continue to receive reward after his death.” Ibn Majah transmitted it, and also Baihaqi in Shu'ab al-iman.

عَنْ أَبِي هُرَيْرَةَ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِنَّ مِمَّا يَلْحَقُ الْمُؤْمِنَ مِنْ عَمَلِهِ وَحَسَنَاتِهِ بَعْدَ مَوْتِهِ عِلْمًا علمه ونشره وَولدا صَالحا تَركه ومصحفا وَرَّثَهُ أَوْ مَسْجِدًا بَنَاهُ أَوْ بَيْتًا لِابْنِ السَّبِيلِ بَنَاهُ أَوْ نَهْرًا أَجْرَاهُ أَوْ صَدَقَةً أخرجهَا من مَاله فِي صِحَّته وحياته يلْحقهُ من بعد مَوته» . رَوَاهُ بن مَاجَه وَالْبَيْهَقِيّ فِي شعب الْإِيمَان

Reference: 5602540
In-book reference: Book 2, Hadith 254