Hadith 4:286

Narrated Salama bin Al-Akwa:

"An infidel spy came to the Prophet while he was on a journey. The spy
sat with the companions of the Prophet and started talking and then
went away. The Prophet said (to his companions), 'Chase and kill him.'
So, I killed him." The Prophet then gave him the belongings of the
killed spy (in addition to his share of the war booty).