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]
Arabic/English book reference: Book 1, Hadith 24