According to Shi'i hadiths, the beginning of the imamate of Imam al-Mahdi (a) was when he was five. God bestowed upon him the qualifications needed for imamate at that young age, just as Yahya (a) was given wisdom in his childhood, and Jesus (a) was chosen as a prophet when he was an infant.Hadiths from the Prophet (s) and Imams (a) mention the imamate of Imam al-Mahdi (a). His father, Imam al-Hasan al-'Askari (a), specifically showed him to his trusted Shi'a and announced his imamate.Believing in a savior is not exclusive to the Shi'a or Muslims. Many religions and sects also maintain similar beliefs. The difference between Twelver Shi'ism and the other religious traditions is the belief in a specific person, who was born in 255/869 and is still alive, as the awaited savior.
Narration from the Prophet (s):
Among the hadiths of the Prophet (s) pointing to the imamate of the twelfth Imam, recorded in Shi'i sources, is the hadith in which the Prophet (s) says to Imam al-Husayn (a), "You are the master, the son of the master; you are the Imam son of the Imam; you are the Proof son of a Proof; you are the father of nine Proofs from your progeny, the ninth of whom is the Riser (al-Qa'im)."
"Mahdi is from my family, from the descendants of Fatima.'"
"Mahdi is from us, Ahl al-Bayt."
"If only one day remains before the world ends, God will raise a man from my family who will fill the earth with justice, while it has become full of injustice and oppression."
In a hadith recorded in al-Khwarazmi's Maqtal, the Prophet (s) declares the names of the Twelve Imams one by one and mentions Imam al-Mahdi (a) as the last Imam.