It was narrated that Abu Hurairah, Zaid bin Khalid and Shibl said:
"We were with the Messenger of Allah (ﷺ) and a man came to him and said: 'I adjure you by Allah (SWT) to judge between us according to the Book of Allah (SWT).' His opponent, who was more knowledgeable than him, said: 'Judge between us according to the Book of Allah (SWT), but let me speak first.' He said: 'Speak.' He said: 'My son was a servant of this man, and he committed adultery with his wife, and I ransomed him for one hundred sheep and a servant. I asked some men of knowledge and I was told that my son should be given one hundred lashes and exiled for a year, and that the wife of this man should be stoned." The Messenger of Allah (ﷺ) said: 'By the One in Whose Hand is my soul, I will judge between you according to the Book of Allah (SWT). The one hundred sheep and the servant are to be returned to you and your son is to be given one hundred lashes and exiled for a year. Go tomorrow, O Unais, to the wife of this man and if she admits I then stone her.'"
English reference: Vol. 3, Book 20, Hadith 2549
Arabic reference: Book 20, Hadith 2646