Jami` at-Tirmidhi, Volume 4, Book 30, Hadith 2142 (DarusSalam) ⓘ
'Anas narrated that the Messenger of Allah (s.a.w) said: "When Allah wants good for a slave, He puts him in action." It was said: "How does he put him in action O Messenger Of Allah?" He said: "By making him meet up with the righteous deeds before death."
حَدَّثَنَا عَلِيُّ بْنُ حُجْرٍ، حَدَّثَنَا إِسْمَاعِيلُ بْنُ جَعْفَرٍ، عَنْ حُمَيْدٍ، عَنْ أَنَسٍ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " إِذَا أَرَادَ اللَّهُ بِعَبْدٍ خَيْرًا اسْتَعْمَلَهُ " . فَقِيلَ كَيْفَ يَسْتَعْمِلُهُ يَا رَسُولَ اللَّهِ قَالَ " يُوَفِّقُهُ لِعَمَلٍ صَالِحٍ قَبْلَ الْمَوْتِ " . قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ .
also referenced under: Hadith 2142 (Reference) & Book 32, Hadith 2292 (In-Book)