The Prophet ﷺ said, "Whoever catches one rakah of the prayer has caught the prayer."
حدثنا نصر بن علي وسعيد بن عبد الرحمن وغير واحد قالوا حدثنا سفيان بن عيينة عن الزهري عن أبي سلمة
عن النبي ﷺ قال من أدرك من الصلاة ركعة فقد أدرك الصلاة
Graded muttafaq alayh. Muslim also reported it in the Book of Mosques, chapter on whoever catches a rakat of the prayer has caught that prayer, hadith 607, from the hadith of Sufyan bin Uyayna. Bukhari reported it, hadith 580, from the hadith of Zuhri, with similar wording.