Mohammad Shah Qajar (Persian: محمدشاه قاجار; born Mohammad Mirza; 5 January 1808 – 5 September 1848) was the third Qajar shah of Iran from 1834 to 1848, inheriting the throne from his grandfather, Fath-Ali Shah. From a young age, Mohammad Mirza was under the tutelage of Haji Mirza Aqasi, a local dervish from Tabriz whose teachings influenced the young prince to become a Sufi-king later in his life. After his father Abbas Mirza died in 1833, Mohammad Mirza became the crown prince of Iran and was assigned with the governorship of Azarbaijan. After the death of Fath-Ali Shah in 1834, some of his sons including Hossein Ali Mirza and Ali Mirza Zel as-Soltan rose up as claimants to the throne. Mohammad Shah soon suppressed the rebellious princes and asserted his authority.
Mohammad Shah dismissed and executed his tactful premier, Abol-Qasem Qa'em-Maqam, and appointed his favourite, Haji Mirza Aqasi, as the grand vizier. The new shah's main goal was to reestablish the rule of the Iranian government in the rebellious city of Herat. In 1837 he marched to Herat and laid a futile siege on the city, which was eventually withdrawn when the British government threatened to invade Iran. On his return, Mohammad suppressed a revolt in Isfahan led by the major clergy figure Mohammad Bagher Shafti. Through British-Russian mediation, he concluded the Second Treaty of Erzurum with the Ottoman Empire, after initially wanting retaliation for the sack of Khorramshahr by the Ottoman governor of Baghdad.