The Messenger of Allah ﷺ said, "Whoever catches one rakah of the prayer has caught the entire prayer."
حدثنا محمد بن عبيد حدثنا عبيد الله عن الزهري عن أبي سلمة
قال رسول الله ﷺ من أدرك من الصلاة ركعة فقد أدركها كلها
Its isnad is sahih. Bukhari related it in 1/151, in the Prayer chapter, on whoever catches up with a rakat, and Muslim in 1/423, number 607, in the Mosques chapter, in the same chapter, and Abu Dawud in 1121, in the Friday Prayer chapter.