Riyad as-Salihin, Book 1, Hadith 24 (In-Book)

Abu Hurairah (May Allah be pleased with him) reported: Messenger of Allah said, "Allah, the Exalted, smiles at two men, one of them killed the other and both will enter Jannah. The first is killed by the other while he is fighting in the Cause of Allah, and thereafter Allah will turn in mercy to the second and guide him to accept Islam and then he dies as a Shaheed (martyr) fighting in the Cause of Allah."[Al-Bukhari and Muslim]

وعن أبي هريرة رضي الله عنه أن رسول الله صلى الله عليه وسلم قال‏:‏ ‏ "‏يضحك الله سبحانه وتعالى إلى رجلين يقتل أحدهما الآخر يدخلان الجنة، يقاتل هذا في سبيل الله فيقتل، ثم يتوب الله على القاتل فيسلم فيستشهد‏" ‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏ ‏.‏

sunnah.com