"The likeness of wealth, family and the actions of the son of Adam is of a man who has three companions. One of the man's companions says: I am with you as long as you live; when you die, you have taken your share of yourself and you have taken your share of me - this is his wealth. The second companion says: I am with you until you reach that tree; you have had your share of yourself and your share of me - this is his family. The third companion says: I am with you in life and in death." [Sahih: Related by Al-Bazzar and Al-Albani authenticated it]
The above authentic hadith is in fact like the following hadith in meaning and in subject matter. Anas said that the Prophet sallallahu 'alayhi wa sallam said:
"The dead person is followed (to his grave) by three: His family, his wealth and his actions. Two of them return and only one remains. His family and wealth return, but his actions remain." [Related by Al-Bukhari and Muslim]
These two ahadith show that actions alone endure and enter the grave with their doers. Both these ahadith also affirm the fact that anything other than actions - such as wealth, servants or relatives - are of no benefit at all. Rather, they all return (to this world). His wealth becomes the property of his inheritor, whilst his relatives and family do not grant him anything from Allah.
These ahadith intend to direct Muslims to be concerned with actions which will stay with them forever; and not to strive for wealth and position for the sake of relatives, family and servants. Apparently, the Prophet sallallahu 'alayhi wa sallam wanted to show us the value of good actions when he related these ahadith to us, (which can be found) in the books of Zuhd (renouncement of the world). He pointed out to us that because actions will last rather than wealth, you have to make your actions righteous. Part of making ones actions righteous is through good wealth that is earned lawfully and spent in a good manner. Then one gains the rewards of 'amalus-salih (a righteous action).