عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ قَالَ: ((إِذَا مَاتَ الْإِنْسَانُ، انْقَطَعَ عَنْهُ عَمَلُهُ إِلَّا مِنْ ثَلَاثَةٍ، إِلَّا مِنْ صَدَقَةٍ جَارِيَةٍ أَوْ عِلْمٍ يُنْتَفَعُ بِهِ، أَوْ وَلَدٍ صَالِحٍ يَدْعُو لَهُ))
It is narrated from Sayyiduna Abu Hurairah, may Allah be pleased with him, that the Noble Prophet, peace and blessings be upon him, said: When a person dies, all his deeds come to an end except for three: (1) ongoing charity, (2) knowledge from which benefit is derived, and (3) a righteous child who prays for him.
Brief Explanation
Benefits: ... The prayers of other people are also beneficial. The specific mention of righteous offspring has two reasons: firstly, that children pray with greater eagerness; and secondly, that children are being encouraged to do so, because it is they who will remember their parents for a longer period of time.