He entered in the 2017 Jakarta gubernatorial elections, with Sandiaga Uno as his running mate. In the first round of voting on 15 February 2017, Baswedan secured passage to the second round run-off between two candidates, having secured approximately 40% of the vote, behind Basuki Tjahaja Purnama, the acting governor (known as Ahok), with 44%, and well ahead of Agus with 16%. On 19 April 2017 Baswedan won the runoff election, with approximately 58% of the votes, ahead of Ahok's 42%. He was officially inaugurated as governor on 16 October 2017, replacing Djarot Saiful Hidayat.