In Islam, an act that involves showing off, self-promotion, or personal interest is called 'riya'. No matter how good an act with riya appears outwardly, it is not acceptable to Allah.
Desire to attain the pleasure of Almighty Allah in all works
The Messenger of Allah (peace be upon him) said, If any good deed has a tendency to show off, Allah does not accept it. (Sunan an-Nasa'i: 3140)
In another famous hadith, the Messenger (peace be upon him) informed that on the Day of Judgment, a scholar, a charitable person, and a martyr will be presented before Allah. Even if they performed many great deeds outwardly, if those were done for the purpose of gaining people's praise, their deeds will not be accepted. (Sahih Muslim: 1905)
More to Read
On the other hand, a small deed done with sincere intention for the pleasure of Allah is extremely valuable to Him. The Messenger (peace be upon him) said,
"Purify and make your religion sincere; then a small deed will be sufficient for you."
In the Holy Quran, Allah Almighty has also commanded,
"They were commanded to worship Allah with sincere devotion."
— (Surah Al-Bayyinah: 5)
He further said,
"Know that pure and sincere worship is only for Allah."
— (Surah Az-Zumar: 3)
In Islam, intention holds the greatest importance. Regarding this, the famous hadith of the Messenger of Allah (peace be upon him)—
"All actions are judged by intentions. Every person will be rewarded according to their intention."
— (Sahih Bukhari: 1)
Therefore, a believer's goal should be to perform every task—worship, charity, education, profession, or social responsibility—solely for the purpose of attaining the pleasure of Almighty Allah. When deeds are done sincerely for Allah, they become a source of welfare in this world and the Hereafter.
Praising this quality of the noble Companions, Allah Almighty says in the Quran,
"Allah is pleased with them, and they are pleased with Him."
— (Surah At-Tawbah: 100)
The true success of a believer's life lies here—dedicating every action with sincerity (Ikhlas) solely for the pleasure of Allah.