All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Every deed, for a slave to be rewarded for it, he should have made the intention for it as the Prophet said: “Verily, deeds are judged according to the intentions (behind them), and every person will get what he has intended.” Some deeds are exclusively performed as acts of worship and, therefore, do not require holding the intention of drawing closer to Allah (to earn their respective rewards) such as prayer, reciting the Quran and the like. Unless someone intends Riyaa’ (showing off by such acts of worship, they count as good deeds by means of which one draws closer to Allah, The Exalted, and he earns their rewards. As for the deeds that may or may not be means of nearness to Allah, the doer must hold the intention of drawing closer to Him when performing them in order to earn their respective rewards. Holding the intention is easy, and one should ignore satanic whisperings in this regard. A doer of any deed must necessarily hold an intention for performing it, and the only thing required is to evoke the intention of drawing closer to Allah by means of this deed.
Allah Knows best.