Abu Masud Uqba bin Amr reported,

The Messenger of Allah ﷺ said, "The one who leads the people in prayer should be the one most versed in the Book of Allah. If they are equal in recitation, then the one most knowledgeable of the Sunnah. If they are equal in knowledge of the Sunnah, then the one who emigrated earliest. If they are equal in emigration, then the one who embraced Islam earliest. A man should not lead another in prayer within his domain of authority, nor sit in his house on his place of honor without his permission."Al-Ashajj, in his narration, said "the eldest in age" instead of "the one who embraced Islam earliest."

Muslim 1532

Sahih

و حدثنا أبو بكر بن أبي شيبة وأبو سعيد الأشج كلاهما عن أبي خالد قال أبو بكر حدثنا أبو خالد الأحمر عن الأعمش عن إسمعيل بن رجاء عن أوس بن ضمعج

عن أبي مسعود الأنصاري قال

قال رسول الله ﷺ يؤم القوم أقرؤهم لكتاب الله فإن كانوا في القراءة سواء فأعلمهم بالسنة فإن كانوا في السنة سواء فأقدمهم هجرة فإن كانوا في الهجرة سواء فأقدمهم سلما ولا يؤمن الرجل الرجل في سلطانه ولا يقعد في بيته على تكرمته إلا بإذنه قال الأشج في روايته مكان سلما سنا

مسلم 1532صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
One who is most deserving of leading the prayer
Numbering
Darussalam 1532
Muslim 1532