Sultan Mahmud Shah II (Raja Kimas) was the second son of Sultan Muhammad Shah ibni al-Marhum Yang DiPertuan Muda Mansur Shah.
He was appointed as Raja Kechil Muda in 1750, and became Raja Muda in 1764. He succeeded the throne following the death of his brother, Sultan Iskandar Dzulkarnain, on 14 July 1765 and was installed at Pulau Indira Sakti a week later. He moved his capital to Pasir Pulai, which he renamed Pasir Pulai Indera Mulia.
He married the daughter of Sultan Alauddin Mughayat Ri’ayat Shah ibni al-Marhum Yang DiPertuan Muda Mansur Shah. Tuanku mangkat at Pasir Pulai Indera Mulia on 17 June 1773.
According to the Hikayat Misa Melayu by Raja Chulan bin Raja Abdul Hamid, Sultan Mahmud Shah was the Sultan of Perak who installed Raja Lumu as the Sultan of Selangor, Sultan Sallehuddin, circa 1770.