TOKYO—Former Defense Minister Yuriko Koike on Sunday was elected governor of Tokyo, becoming the first woman in the post and taking the helm four years before the city plays host to the 2020 Summer Olympic Games.

Ms. Koike, 64 years old, is a member of parliament from Prime Minister Shinzo Abe’s ruling Liberal Democratic Party, but she failed to get the party’s endorsement and ran as an independent. With most of the vote counted, Ms. Koike easily defeated Hiroya Masuda, a former governor of a northern prefecture who had the LDP’s endorsement, and journalist Shuntaro Torigoe.

Ms. Koike will be Tokyo’s fourth governor since 2012 after scandals involving political funds toppled the previous two governors. Former Gov. Yoichi Masuzoeresigned in June.

A former newscaster and a fluent English speaker, Ms. Koike is one of the best-known politicians in Japan. As environment minister in 2005, she was instrumental in introducing the “cool biz” program in which government officials were told to shed their ties and often their jackets during the summer months so that thermostats could be set at a higher level.

The concept was widely adopted by private employers, and now most men go without tie and jacket in the summer.