Sa'id bin al-Musayyib (may Allah have mercy on him) said: When death approached a man from the Ansar (may Allah be pleased with him), he said: I am going to narrate a hadith to you, and I narrate it to you only seeking reward from Allah. I heard the Messenger of Allah (peace and blessings be upon him) say: "When one of you performs ablution and does it well, then goes out to the prayer, he does not lift his right foot except that Allah Almighty records a good deed for him, and he does not put down his left foot except that a sin is removed from him, whether he takes short steps or long. If he comes to the mosque and prays in congregation, he is forgiven. If he comes to the mosque when part of the prayer has been prayed and part remains, and he prays what he catches and completes what remains, it is the same for him. And if he comes to the mosque when they have already prayed, and he completes the prayer, it is the same for him."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5011