‘Umar ibn al-Khattāb (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said: "Verily, the reward of deeds depends on the intentions, and each person will be rewarded according to what he intended. So, he whose migration is for the sake of Allah and His Messenger, then his migration is for the sake of Allah and His Messenger, and he whose migration is to achieve some worldly gain or to take some woman in marriage, then his migration is for that for which he migrated."
This is a greatly significant Hadīth and some of the scholars have considered it to be one third of Islam. The believer will be rewarded according to his intention and the level of its righteousness. So the one whose deeds are sincerely devoted to Allah, they will be accepted even if they are few on condition that they comply with the Sunnah. On the other hand, the one whose deeds are done for the sake of showing off before people and are not sincerely devoted to Allah, they will be rejected even if they are grand and numerous. Any deed that is done for the sake of something other than Allah, whether it is done for the sake of a woman, money, prominence, or any other worldly affair, Allah will not accept it. This is because the two conditions for the acceptance of any righteous deed are: that it be sincerely devoted to Allah alone, and that it complies with the guidance of the Messenger of Allah (may Allah's peace and blessings be upon him).