It is narrated from Sayyiduna Ali (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "The key to prayer is ablution, its beginning is the takbir, and its exit is the salam."
Imam al-Shafi'i (may Allah have mercy on him) said in his old opinion (al-qawl al-qadim) that the same has been reported from Sayyiduna Ibn Mas'ud (may Allah be pleased with him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2261