Sahih Bukhari | Volume 8 | Hadith Number 775

Narrated by 'Ubada bin As-Samit
We were with the Prophet in a gathering and he said, 'Swear allegiance to me that you will not worship anything besides Allah, Will not steal, and will not commit illegal sexual intercourse." And then (the Prophet) recited the whole Verse (i.e. 60:12). The Prophet added, 'And whoever among you fulfills his pledge, his reward is with Allah; and whoever commits something of such sins and receives the legal punishment for it, that will be considered as the expiation for that sin, and whoever commits something of such sins and Allah screens him, it is up to Allah whether to excuse or punish him."