Germany's ruling Christian Democrat Union has chosen Annegret Kramp-Karrenbauer as their new party leader, but Angela Merkel plans to serve out her term as chancellor until 2021.
The CDU general secretary won 517 of the 999 votes cast.
She narrowly defeated Friedrich Merz, a millionaire lawyer, who received 482 votes at the party conference.
As the head of Germany's largest party, Ms Kramp-Karrenbauer could become the next German chancellor.
The 56-year-old former prime minister of the state of Saarland was a party favourite and Ms Merkel's choice for succession.
Earlier during her farewell speech as party leader, Mrs Merkel praised Ms Kramp-Karrenbauer - who is known as AKK - for her 2017 electoral success in Saarland, in a clear hint of the chancellor's personal preference in the leadership race.