Abu Masud Uqba bin Amr reported,

I was beating a slave boy of mine when I heard a voice behind me saying, "Know, Abu Masud, that Allah has more power over you than you have over him."I turned around and there was the Messenger of Allah ﷺ. I said, "Messenger of Allah, he is free for the sake of Allah."He said, "Had you not done so, the Fire would have scorched you," or "the Fire would have touched you."

Azami 6171

Sahih

عن أبي مسعود الأنصاري قال

كنت أضرب غلاما لي، فسمعت من خلفي صوتا: اعلم أبا مسعود: الله أقدر عليك منك عليه. فالتفت، فإذا هو رسول الله ﷺ، فقلت: يا رسول الله، هو حر لوجه الله، فقال: أما لو لم تفعل للفحتك النار، أو لمستك النار.

الأعظمي 6171صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Emancipation of slaves
Section
Expiation for one who wrongs his slave is to free him
Numbering
Jami al-Kamil 6171 (2nd edition)
Azami 6171