Abu Hurairah reported,

The Messenger of Allah ﷺ said, "When a person dies, their deeds come to an end except for three, an ongoing charity, knowledge that continues to benefit others, or a righteous child who prays for them."

Azami 3548

Sahih

عن أبي هريرة

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

الأعظمي 3548صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Dying person
Section
What benefits the deceased after death
Numbering
Jami al-Kamil 3548 (2nd edition)
Azami 3548