Abu Mas'ud Al-Badri (May Allah be pleased with him) said:
I was beating my slave with a whip when I heard a voice behind me which said: "Abu Mas'ud! Bear in mind..." I did not recognize the voice for the intense anger I was in. Abu Mas'ud added: As he came near me, I found that he was the Messenger of Allah (ﷺ) who was saying, "Abu Mas'ud! Bear in mind that Allah has more dominance upon you than you have upon your slave." Then I said: "I will never beat any slave in future."Another narration is: The whip dropped from my hand in awe of the Prophet (ﷺ).Still another narration is: I said: "He is free for the sake of Allah." He (ﷺ) said, "If you had not done this, you would have been singed by the Fire."[Muslim].
App reference: Book 18, Hadith 94
Arabic/English book reference: Book 18, Hadith 1604