Anas bin Malik reported,

The Prophet ﷺ was thrown from a horse and his right side was grazed. We came to visit him, and when the time for prayer arrived, he led us in prayer while seated, and we prayed behind him seated.When he finished the prayer, he said, "The imam is appointed only to be followed. So when he says the takbir, say the takbir. When he bows, bow. When he says, 'Allah hears the one who praises Him,' say, 'Our Lord, to You belongs all praise.' When he prostrates, prostrate. And when he prays seated, all of you pray seated."

Ibn Majah 1238

Sahih

حدثنا هشام بن عمار حدثنا سفيان بن عيينة عن الزهري

عن أنس بن مالك

أن النبي ﷺ صرع عن فرس فجحش شقه الأيمن فدخلنا نعوده وحضرت الصلاة فصلى بنا قاعدا وصلينا وراءه قعودا فلما قضى الصلاة قال إنما جعل الإمام ليؤتم به فإذا كبر فكبروا وإذا ركع فاركعوا وإذا قال سمع الله لمن حمده فقولوا ربنا ولك الحمد وإذا سجد فاسجدوا وإذا صلى قاعدا فصلوا قعودا أجمعين

ابن ماجه 1238صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Establishing prayer and the sunnah regarding it
Chapter
Imam is appointed to be followed
Numbering
Darussalam 1238
Ibn Majah 1238