It is made clear in the Quran and the Sunnah that for an action to be a righteous action and for it to be acceptable to Allaah, the One free of all imperfections, and one which draws a person close to Him, then it must fulfil two important conditions.
The first is that the intention of the person doing must be sincerely for the sake of Allaah.
The second is that it must be in accordance with what Allaah, the Blessed Most High, prescribed in His Book and what His Messenger (صلى الله عليه وسلم) explained in the Sunnah.
If one of the two conditions is absent then the action is neither a righteous action nor is it acceptable. This is indicated by the saying of Allaah, the Blessed and the Most High:
فَمَن كَانَ يَرْجُو لِقَاء رَبِّهِ فَلْيَعْمَلْ عَمَلًا صَالِحًا وَلَا يُشْرِكْ بِعِبَادَةِ رَبِّهِ أَحَدًا
"...So whoever hopes for the meeting with his Lord, let him work righteousness and associate none as a partner in the worship of his Lord."
(Surah Al-Kahf: verse 110)
So He, the One free of all imperfections, orders that the actions should be "righteous", that is in accordance with the Sunnah. Then He orders that it should be done purely for Him and not for any incentive. Al Haafidh Ibn Kathir said in his tafseer: "These two things are the two pillars of an acceptable action, it must be done purely for Allaah, and done correctly in the manner prescribed in the Sharee'ah of Allaah's Messenger (صلى الله عليه وسلم)." This is also reported from al-Qadee 'Iyaad, rahimahullaah, and others.
Taken from "Tawassul" by Shaykh Muhammad Naasiruddin al-Albani
(Published by Al-Hidaayah)