Sunan Ibn Majah, Hadith 2538 ⓘ
It was narrated from Abu Hurairah that the Messenger of Allah said: “A legal punishment that is carried out in the land is better for the people of that land than if it were to rain for forty days.”
حَدَّثَنَا عَمْرُو بْنُ رَافِعٍ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ الْمُبَارَكِ، أَنْبَأَنَا عِيسَى بْنُ يَزِيدَ، أَظُنُّهُ عَنْ جَرِيرِ بْنِ يَزِيدَ، عَنْ أَبِي زُرْعَةَ بْنِ عَمْرِو بْنِ جَرِيرٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " حَدٌّ يُعْمَلُ بِهِ فِي الأَرْضِ خَيْرٌ لأَهْلِ الأَرْضِ مِنْ أَنْ يُمْطَرُوا أَرْبَعِينَ صَبَاحًا " .
also referenced under: Book 20, Hadith 2635 (In-Book) & Volume 3, Book 20, Hadith 2538 (DarusSalam)