Reference: Fataawa Noor ‘alad-Darb – Question No.6259, Page 96, Volume 12
Question: How do good deeds wipe away sins? Is it [as simple as] the sins just go away and the [reward for] good deeds remain?
Response: Yes, this is how Allaah (‘Azza wa Jall) said [so]:
So based upon this, if a person does a good deed after he has committed a sin, then [in shaa.-Allaah] it will be [a cause for it being] wiped out, particularly if the good deed is [the act of] repentance from [having fallen into] that sin. Indeed, [sincere] repentance wipes out that which has passed [from sins]; [in this regard], Allaah (Tabaaraka wa Ta’aala) said: