The Messenger of Allah ﷺ said, "Allah feels protective jealousy, and the believer feels protective jealousy. Allah's protective jealousy is provoked when a believer does what He has forbidden him."
حدثنا سليمان حدثنا حرب وأبان عن يحيى بن أبي كثير حدثنى أبو سلمة أن
أن رسول الله ﷺ قال إن الله عز وجل يغار وإن المؤمن يغار وغيرة الله أن يأتي المؤمن ما حرم عليه
Its chain is sahih. Muslim narrated it in the Book of Repentance, chapter on Allah's jealousy and the prohibition of shameful acts, 4/2114, no. 2761, and Tirmidhi in 3/462, no. 1168, in the Book of Suckling, chapter on what has been said about jealousy, both with the same wording. Bukhari also narrated it in 7/45, in the Book of Marriage, chapter on jealousy, with wording close to it.