The governing conservative party in Poland, Law and Justice, has lost the mayoral election in Warsaw to the liberal opposition Civic Platform.
Left-wing backing ensured Ms Gronkiewicz-Waltz won
Hanna Gronkiewicz-Waltz will become Warsaw's first woman mayor.
The result is seen as a big blow to Law and Justice and President Lech Kaczynski, who used to be the mayor.
Ms Gronkiewicz-Waltz won Sunday's runoff vote with 53.2%, compared with 46.8% for Kazimierz Marcinkiewicz, a former prime minister.
Law and Justice fared better in smaller towns and rural areas than in big cities - except for Lodz, the second largest city.
Mr Marcinkiewicz had a slim lead after the first round
Law and Justice came to power a year ago on a promise to uphold traditional Catholic values, but it has struggled to maintain a viable coalition and has had prickly relations with Poland's key neighbours, Germany and Russia.
President Lech Kaczynski's twin brother Jaroslaw is prime minister.
In Krakow, Law and Justice challenger Ryszard Terlecki failed to dislodge incumbent mayor Jacek Majchrowski.
But in Lodz, Poland's second biggest city, Law and Justice's Jerzy Kropiwnicki held off a challenge from liberal Krzysztof Kwiatkowski to win a second term.