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.
Spying and searching for the faults of others is forbidden in the Sharee’ah. Allah Says (what means): {And do not spy.} [Quran 49:12]
Al-Qurtubi said: “The meaning of the verse is: “Take what is apparent and do not search for the faults of Muslims. In other words, none of you should look for the flaws of his Muslim brother to expose him after Allah has concealed him. Abu Daawood reported from Mu'aawiyyah, who said: “I heard the Prophet saying: “If you search for the faults of the people, you will corrupt them, or will nearly corrupt them.” [End of quote]
Moreover, Abu Barzah narrated that the Prophet said: “O you people who believed by their tongue (verbally), but belief did not enter their hearts, do not back-bite Muslims, and do not search for their faults, for if anyone searches for the faults of his (Muslim) brother, then Allah will expose his faults, even if he were in the depth of his house.” [Ahmad]
Repentance from spying is achieved by regretting it and being determined not to return to it again in the future, but it is not necessary to inform the person whom someone has spied on.
Allah knows best.