Chiang Wan-an of Taiwan's Kuomintang (KMT) party has narrowly held onto his job as Taipei mayor, edging out Democratic Progressive Party (DPP) challenger Puma Shen.
The KMT also took 11 seats to the DPP's 10 across Taiwan.
After his win, Chiang called out, "Together, we have made this a celebration of democracy," and thanked "legislator Shen and his supporters."
Puma Shen energized online supporters
Puma Shen, known for speaking up against China, was savvy on social media and whipped up a frenzy of support.
Chiang faced stiffer competition than before and depended on support from older, more conservative voters, many of whom do not usually show up in polls because they prefer to keep their politics private.
With concerns about possible Chinese interference in the background, this election was another reminder of how seriously Taiwan takes its democracy.