Abu Mas'ud al-Ansari (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "The one who knows the most Qur'an should lead the people in prayer. If they are equal in the Qur'an, then the one who was earliest in emigration (hijrah). If they are equal in emigration, then the one among them with the most understanding (of the religion). If they are equal in understanding, then the one who is oldest in age. No one should lead a man in prayer within his domain of authority, nor sit in his place of honour in his house, but he may sit there with his permission."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5286