Abu Hurairah reported,

The Messenger of Allah ﷺ led us in the afternoon prayer and gave the closing salutation after only two units. Dhul-Yadayn stood up and asked, "Messenger of Allah, has the prayer been shortened, or did you forget?"The Messenger of Allah ﷺ replied, "Neither happened."Dhul-Yadayn said, "One of them did happen, Messenger of Allah."The Messenger of Allah ﷺ then turned to the people and asked, "Has Dhul-Yadayn spoken the truth?"They answered, "Yes."So the Messenger of Allah ﷺ completed what remained of the prayer, then performed two prostrations while seated after the closing salutation.

Nasai 1227

Sahih

أخبرنا قتيبة عن مالك عن داود بن الحصين عن أبي سفيان مولى ابن أبي أحمد أنه قال سمعت

أبا هريرة يقول

صلى لنا رسول الله ﷺ صلاة العصر فسلم في ركعتين فقام ذو اليدين فقال أقصرت الصلاة يا رسول الله أم نسيت فقال رسول الله ﷺ كل ذلك لم يكن فقال قد كان بعض ذلك يا رسول الله فأقبل رسول الله ﷺ على الناس فقال أصدق ذو اليدين فقالوا نعم فأتم رسول الله ﷺ ما بقي من الصلاة ثم سجد سجدتين وهو جالس بعد التسليم

النسائي 1227صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Forgetfulness
Chapter
What one should do if he gives salaam after two rakahs forgetfully and speaks
Numbering
Darussalam 1227
Nasai 1227