Sunan an-Nasa'i, Volume 3, Book 22, Hadith 2204 (DarusSalam)

It was narrated from Abu Hurairah that the Prophet said: "Whoever fasts during Ramadan" and according to the Hadith of Qutaibah, the Prophet said: "Whoever spends the nights of Ramadan in prayer (Qiyam) out of faith and in the hope of reward, he will be forgiven his previous sins, and whoever spends the night of Lailat Al-Qadr in prayer out of faith and in the hope of reward, he will be forgiven his previous sins." '

أَخْبَرَنَا قُتَيْبَةُ، وَمُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ يَزِيدَ، قَالاَ حَدَّثَنَا سُفْيَانُ، عَنِ الزُّهْرِيِّ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏"‏ مَنْ صَامَ رَمَضَانَ ‏"‏ ‏.‏ وَفِي حَدِيثِ قُتَيْبَةَ أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏"‏ مَنْ قَامَ شَهْرَ رَمَضَانَ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ وَمَنْ قَامَ لَيْلَةَ الْقَدْرِ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ ‏"‏ ‏.‏

sunnah.com