The Messenger of Allah ﷺ said, "Whoever catches one rakah of the prayer has caught the prayer."
حدثنا القعنبي عن مالك عن ابن شهاب عن أبي سلمة
قال رسول الله ﷺ من أدرك ركعة من الصلاة فقد أدرك الصلاة
Bukhari narrated it in the Book of the Times of Prayer, Chapter of one who catches a rakat of the prayer, hadith no. 580, and Muslim in the Book of Mosques, Chapter of one who catches a rakat of the prayer has caught that prayer, hadith no. 607, from the hadith of Malik through this same chain. It is also found in Muwatta (Yahya), 1/10 (and Qanabi, pp. 35, 36).