Anas bin Malik reported,

A Jewish man came to the Prophet ﷺ and his companions and said, "As-samu alaykum (death be upon you)."The people returned the greeting.The Prophet of Allah ﷺ asked, "Do you know what this man just said?"They replied, "Allah and His Messenger know best. Did he not greet us with peace, Prophet of Allah?"He said, "No, he actually said such and such. Bring him back to me."So they brought him back, and the Prophet asked, "Did you say, 'As-samu alaykum'?"The man answered, "Yes."At that, the Prophet of Allah ﷺ said, "When any of the People of the Book greets you, respond by saying, 'And upon you what you have said.'"He then recited, "And when they come to you, they greet you with that with which Allah does not greet you" [Mujadilah 58:8].

Tirmidhi 3301

Sahih

حدثنا عبد بن حميد حدثنا يونس عن شيبان عن قتادة

حدثنا أنس بن مالك

أن يهوديا أتى على النبي ﷺ وأصحابه فقال السام عليكم فرد عليه القوم فقال نبي الله ﷺ هل تدرون ما قال هذا قالوا الله ورسوله أعلم سلم يا نبي الله قال لا ولكنه قال كذا وكذا ردوه علي فردوه قال قلت السام عليكم قال نعم قال نبي الله ﷺ عند ذلك إذا سلم عليكم أحد من أهل الكتاب فقولوا عليك ما قلت قال {وإذا جاءوك حيوك بما لم يحيك به الله}

الترمذي 3301صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Tafsir of the Quran
Chapter
From Surah Mujadilah
Numbering
Darussalam 3301
Tirmidhi 3301