The Peruvian capital, Lima, finally has an elected mayor after nearly a month of recounts.
Leftist Susana Villaran defeated her conservative opponent, Lourdes Flores, by less than one point to become the capital's first elected female leader.
The election itself was held on 3 October but, amid challenges, more than a million votes were re-examined.
Ms Villaran, a human rights activist, has vowed to tackle corruption in Lima, which is home to a third of Peruvians.
It was always clear that the Peruvian capital would have its first elected woman mayor since it was founded in 1535, but with the race tight from beginning to end, the only doubt was who it would be.
A quarter of the ballots were challenged and had to be recounted.
In the end - with 97% of the votes counted - Ms Flores, on 37.57%, conceded victory to Ms Villaran, who had 38.39%.
Ms Villaran, a 61-year-old human rights advocate, is also Lima's first elected left-wing mayor since the early 1980s.