Abu Hurairah reported,

The Messenger of Allah ﷺ said, "Among the things that continue to reach a believer from his deeds and good works after his death are knowledge he taught and spread, a righteous child he left behind, a copy of the Quran he passed on as inheritance, a mosque he built, a lodging he built for the wayfarer, a stream he caused to flow, or charity he gave from his wealth while in good health during his lifetime. These will reach him after his death."

Azami 1193

Hasan

عن أبي هريرة، قال

قال رسول الله ﷺ: إن مما يلحق المؤمن من عمله وحسناته بعد موته: علما علمه ونشره، وولدا صالحا تركه، ومصحفا ورثه، أو مسجدا بناه، أو بيتا لابن السبيل بناه، أو نهرا أجراه، أو صدقة أخرجها من ماله في صحته وحياته، يلحقه بعد موته.

الأعظمي 1193حسن
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Knowledge
Chapter
Encouragement to seek knowledge
Section
Beneficial knowledge having unending reward
Numbering
Jami al-Kamil 1193 (2nd edition)
Azami 1193