Abdullah bin Umar reported,

The Prophet ﷺ led the prayer of fear with one of the two groups, praying one rakah with them while the other group faced the enemy. Then they withdrew and took the position of the others, and the others came forward, and he prayed another rakah with them and gave the salam. Then this group stood and completed their remaining rakah, and the other group stood and completed their remaining rakah.

Tirmidhi 564

Sahih

حدثنا محمد بن عبد الملك بن أبي الشوارب حدثنا يزيد بن زريع حدثنا معمر عن الزهري

عن سالم عن أبيه

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

الترمذي 564صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Travel
Chapter
Prayer of fear
Numbering
Darussalam 564
Tirmidhi 564