Allāh’s Messenger (SAW) said, “Whoever loves for the sake of Allāh, hates for the sake of Allāh, gives for the sake of Allāh, and withholds for the sake of Allāh has perfected faith.” (Abū Dāwūd)
The location of love and hate is the heart, the place for giving and withholding is the limbs. The ḥadīth sets the condition that all must be done with sincerity which is the very spirit and essence of faith.
To love for the sake of Allāh means to love Allāh, to love the acts, times, periods and circumstances that He loves, and to love those He loves such as the Prophets and their followers.
To hate for the sake of Allāh means to hate everything that Allāh hates such as disbelief, sin and transgression, it also means to disavow those who have these qualities or call to them.
The term giving covers the servant doing everything that he has been enjoined to as mentioned in His saying, “As for him who gives and has taqwā and confirms the Good, We will pave his way to ease” (Q92:5-7)
This āyah refers to the servant giving everything he has been ordered to, not just property and wealth. Giving wealth is just a part of giving. The same applies to its opposite, withholding.
Through these four matters does the servant perfect his faith and religion.