She won the mayoral election.

Literal

She [topic-は] mayor election [at-に] succeeded.

成功する ('to succeed') takes に to mark what one succeeds *in* — 試験に成功する ('succeed in the exam'), 選挙に成功する ('succeed in the election'). This に of the field of success is one of に's many roles. 市長選挙 is a Sino-Japanese compound chain — 市 ('city') + 長 ('head') + 選挙 ('election') — a typical formal compound in news contexts. Female mayors are still relatively rare in Japan; even progressive cities have struggled to elect them.