While I was sitting with the Messenger of Allah ﷺ, a woman came to him and said, "She" (meaning her mother, who had died) "never performed Hajj. Shall I perform Hajj on her behalf?"He replied, "Perform Hajj on her behalf."
بينا أنا جالس عند رسول الله ﷺ إذ أتته امرأة فقالت: إنها (تعني أنها وقد ماتت) لم تحج قط أفأحج عنها؟ قال: حجي عنها.
Muslim reported it in the Book of Fasting (1149) from Ali bin Hajar Saadi, who narrated from Ali bin Mushir Abu Hasan, from Abdullah bin Ata, from Abdullah bin Burayda, from his father, and he mentioned it in a long hadith, part of which he mentioned under zakat, and part of it under fasting.