Language:
كتاب الجهاد والسير
56  
Fighting for the Cause of Allah (Jihaad)
(173)
Chapter: If an infidel warrior comes in an Islamic territory
(173)
باب الْحَرْبِيِّ إِذَا دَخَلَ دَارَ الإِسْلاَمِ بِغَيْرِ أَمَانٍ
Sahih al-Bukhari 3051

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).

حَدَّثَنَا أَبُو نُعَيْمٍ، حَدَّثَنَا أَبُو الْعُمَيْسِ، عَنْ إِيَاسِ بْنِ سَلَمَةَ بْنِ الأَكْوَعِ، عَنْ أَبِيهِ، قَالَ أَتَى النَّبِيَّ صلى الله عليه وسلم عَيْنٌ مِنَ الْمُشْرِكِينَ وَهْوَ فِي سَفَرٍ، فَجَلَسَ عِنْدَ أَصْحَابِهِ يَتَحَدَّثُ ثُمَّ انْفَتَلَ، فَقَالَ النَّبِيُّ صلى الله عليه وسلم ‏ "‏ اطْلُبُوهُ وَاقْتُلُوهُ ‏"‏‏.‏ فَقَتَلَهُ فَنَفَّلَهُ سَلَبَهُ‏.‏
Reference : Sahih al-Bukhari 3051
In-book reference : Book 56, Hadith 257
USC-MSA web (English) reference : Vol. 4, Book 52, Hadith 286
  (deprecated numbering scheme)