كتاب الصيام
13  
The Book of Fasting
(27)
Chapter: Making up fasts on behalf of the deceased
(27)
باب قَضَاءِ الصِّيَامِ عَنِ الْمَيِّتِ
Sahih Muslim 1149 a

Abdullah b. Buraida (Allah be pleased with him) reported on the authority of his father:

When we were sitting with the Messenger of Allah (ﷺ), a woman came to him and said: I had gifted to my mother a maid-servant, and now she (the mother) has died. Thereupon he (the Holy Prophet) said: There is a definite reward for you and she (the maid-servant) has been returned to you as an inheritance. She (that woman) again said: Fasts of a month (of Ramadan) are due upon her; should I observe them on her behalf? He (the Holy Prophet) said: Observe fasts on her behalf. She (again) said: She did not perform Hajj, should I perform it on her behalf? He (the Holy Prophet) said: Perform Hajj on her behalf.
وَحَدَّثَنِي عَلِيُّ بْنُ حُجْرٍ السَّعْدِيُّ، حَدَّثَنَا عَلِيُّ بْنُ مُسْهِرٍ أَبُو الْحَسَنِ، عَنْ عَبْدِ اللَّهِ، بْنِ عَطَاءٍ عَنْ عَبْدِ اللَّهِ بْنِ بُرَيْدَةَ، عَنْ أَبِيهِ، - رضى الله عنه - قَالَ بَيْنَا أَنَا جَالِسٌ، عِنْدَ رَسُولِ اللَّهِ صلى الله عليه وسلم إِذْ أَتَتْهُ امْرَأَةٌ فَقَالَتْ إِنِّي تَصَدَّقْتُ عَلَى أُمِّي بِجَارِيَةٍ وَإِنَّهَا مَاتَتْ - قَالَ - فَقَالَ ‏"‏ وَجَبَ أَجْرُكِ وَرَدَّهَا عَلَيْكِ الْمِيرَاثُ ‏"‏ ‏.‏ قَالَتْ يَا رَسُولَ اللَّهِ إِنَّهُ كَانَ عَلَيْهَا صَوْمُ شَهْرٍ أَفَأَصُومُ عَنْهَا قَالَ ‏"‏ صُومِي عَنْهَا ‏"‏ ‏.‏ قَالَتْ إِنَّهَا لَمْ تَحُجَّ قَطُّ أَفَأَحُجُّ عَنْهَا قَالَ ‏"‏ حُجِّي عَنْهَا ‏"‏ ‏.‏
Reference : Sahih Muslim 1149a
In-book reference : Book 13, Hadith 203
USC-MSA web (English) reference : Book 6, Hadith 2558
  (deprecated numbering scheme)