The 45-year-old freight transport worker, whose first and middle names match those of the 20th century dictators Adolf Hitler and Benito Mussolini, stood for the leftwing Ahora Nación party. He will take office on 1 January.
According to the national office of electoral processes, his closest rival, far-right candidate Gaspar Osorio, received 204 votes.
Flores previously belonged to Popular Force, the party of Peru’s rightwing president, Keiko Fujimori, until 2025, electoral authorities said.
While the name Hitler is associated with Germany’s Nazi leader, several candidates with the name have won elections in Peru in recent years. In 2021, doctor Hitler Saavedra Casternoque was elected to parliament for the centrist party Somos Peru. In 2018, Hitler Alba Sánchez became mayor of the Andean district of Yungar, saying during his campaign that he was “the good Hitler”.