Bulugh al-Maram, Book 10, Hadith 1212 (In-Book)

'Imran bin Husain (RAA) narrated, 'A woman from Juhainah came to the Prophet while she was pregnant due to committing adultery and said, 'O Messenger of Allah! I have done something for which a prescribed punishment is to be inflicted, so please inflict it on me. The Messenger of Allah called her guardian and said, "Be good to her, and when she delivers bring her back to me." Her guardian brought her back when she had delivered and the Messenger of Allah gave his commands and her clothes were tied around her and then the Prophet gave his commands and she was stoned to death. The Messenger of Allah offered funeral prayer for her and thereupon 'Umar said, 'O Messenger of Allah! You offer funeral prayer for her even though she committed adultery?' The Messenger of Allah replied, "She has offered such a repentance (for her sin) that if it was divided between seventy of the inhabitants of Madinah, it would be sufficient for them. Have you found such repentance better than sacrificing her life for the sake of Allah, the Almighty?" Related by Muslim.

وَعَنْ عِمْرَانَ بْنِ حَصِينٍ ‏- رضى الله عنه ‏- { أَنَّ اِمْرَأَةً مِنْ جُهَيْنَةَ أَتَتْ نَبِيَّ اَللَّهِ ‏- صلى الله عليه وسلم ‏-‏-وَهِيَ حُبْلَى مِنْ اَلزِّنَا‏-فَقَالَتْ: يَا نَبِيَّ اَللَّهِ! أَصَبْتُ حَدًّا, فَأَقِمْهُ عَلَيَّ, فَدَعَا نَبِيُّ اَللَّهِ ‏- صلى الله عليه وسلم ‏-وَلِيَّهَا.‏ فَقَالَ: "أَحْسِنْ إِلَيْهَا فَإِذَا وَضَعَتْ فَائْتِنِي بِهَا" فَفَعَلَ.‏ فَأَمَرَ بِهَا فَشُكَّتْ عَلَيْهَا ثِيَابُهَا, ثُمَّ أَمَرَ بِهَا فَرُجِمَتْ, ثُمَّ صَلَّى عَلَيْهَا, فَقَالَ عُمَرُ: أَتُصَلِّي عَلَيْهَا يَا نَبِيَّ اَللَّهِ وَقَدْ زَنَتْ? فَقَالَ: "لَقَدْ تَابَتْ تَوْبَةً لَوْ قُسِّمَتْ بَيْنَ سَبْعِينَ مِنْ أَهْلِ اَلْمَدِينَةِ لَوَسِعَتْهُمْ, وَهَلْ وَجَدَتْ أَفَضَلَ مِنْ أَنْ جَادَتْ بِنَفْسِهَا لِلَّهِ? } ".‏ رَوَاهُ مُسْلِمٌ (1578)‏.‏ ‏2 ‏- صحيح رواه مسلم (1696)‏.‏

sunnah.com

also referenced under: Book 10, Hadith 1251 (English)