Sahih Muslim Book 6, Hadith Number 2558.

Chapter : Completing of the fast on behalf of the dead.

Abdullah b. Buraida (Allah be pleased with him) reported on the authority of his father: When we were sitting with the Messenger of Allah (may peace be upon him), 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.