أَخْبَرَنَا عَلِيُّ بْنُ حُجْرٍ، قَالَ حَدَّثَنَا إِسْمَاعِيلُ، قَالَ حَدَّثَنَا الْعَلاَءُ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ إِذَا مَاتَ الإِنْسَانُ انْقَطَعَ عَمَلُهُ إِلاَّ مِنْ ثَلاَثَةٍ مِنْ صَدَقَةٍ جَارِيَةٍ وَعِلْمٍ يُنْتَفَعُ بِهِ وَوَلَدٍ صَالِحٍ يَدْعُو لَهُ ‏"‏‏.‏
Translation
It was narrated that Ash-Sharid bin Suwaid Ath-Thaqafi said

"I came to the Messenger of Allah and said: 'My mother left a will saying that a slave should be freed on her behalf. I have a Nubian slave girl; will it suffice if I free her on her behalf?' He said: 'Bring her here.' The Prophet said to her: 'Who is your Lord?' She said: 'Allah.' He said: 'Who am I?' She said: 'The Messenger of Allah.' He said: 'Set her free , for she is a believer.'"