From Abu Hurairah – radiyallaahi ‘anhu – who said: Allaah’s Messenger – salallaahu ‘alayhi wa sallam – said:
Among the deeds and virtues whose reward will reach the Believer after his death are: knowledge that he taught and disseminated; a righteous son whom he left behind; a written copy of the Qur`aan which he left as a legacy; or a mosque that he built; or a house that he built for the passing traveller; or a canal which he dug and caused to flow; or charity which he gave from his property whilst he was alive and well, for which he will continue to receive reward after his death.
Reported by Ibn Maajah (no.242), Ibn Khuzaymah (4/121/2490), and al-Bayhaqee in Shu`abul-Eemaan (3/274/3448).