Language:
كتاب الرقاق
81  
To make the Heart Tender (Ar-Riqaq)
(12)
Chapter: Whatever one spends from his money will be better for him
(12)
باب مَا قَدَّمَ مِنْ مَالِهِ فَهْوَ لَهُ
Sahih al-Bukhari 6442

Narrated `Abdullah:

The Prophet (ﷺ) said, "Who among you considers the wealth of his heirs dearer to him than his own wealth?" They replied, "O Allah's Messenger (ﷺ)! There is none among us but loves his own wealth more." The Prophet (ﷺ) said, "So his wealth is whatever he spends (in Allah's Cause) during his life (on good deeds) while the wealth of his heirs is whatever he leaves after his death."

حَدَّثَنِي عُمَرُ بْنُ حَفْصٍ، حَدَّثَنِي أَبِي، حَدَّثَنَا الأَعْمَشُ، قَالَ حَدَّثَنِي إِبْرَاهِيمُ التَّيْمِيُّ، عَنِ الْحَارِثِ بْنِ سُوَيْدٍ، قَالَ عَبْدُ اللَّهِ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏"‏ أَيُّكُمْ مَالُ وَارِثِهِ أَحَبُّ إِلَيْهِ مِنْ مَالِهِ ‏"‏‏.‏ قَالُوا يَا رَسُولَ اللَّهِ مَا مِنَّا أَحَدٌ إِلاَّ مَالُهُ أَحَبُّ إِلَيْهِ‏.‏ قَالَ ‏"‏ فَإِنَّ مَالَهُ مَا قَدَّمَ، وَمَالُ وَارِثِهِ مَا أَخَّرَ ‏"‏‏.‏
Reference : Sahih al-Bukhari 6442
In-book reference : Book 81, Hadith 31
USC-MSA web (English) reference : Vol. 8, Book 76, Hadith 449
  (deprecated numbering scheme)