Sunan an-Nasa'i, Book 11, Hadith 82 (Nasa'i 959)

It was narrated from Ibn Abbas that:

The Prophet (ﷺ) prostrated in Sad and said: "Dawud did this prostration in repentance and we do it in thanksgiving."