Opposition candidates won the mayoral race in Budapest, the capital, and were also projected to win in 10 of the country's 23 largest cities. In 2014, the opposition won just three of those races.
Fidesz, which had won every major election since 2010, kept up its dominance in smaller cities and towns and, especially, in rural areas.
In Budapest, however, where Fidesz has long faced more resistance than practically anywhere else in the country, opposition candidate Gergely Karacsony, a former pollster and mayor of a Budapest district, headed to a victory with the backing of five left-wing, liberal and Green Parties.
With 90.5% of the votes counted, Karacsony had 50.8%, compared to 44.2% for incumbent Istvan Tarlos, who called to congratulate his rival.
"The campaign is over, now the work begins," Karacsony told supporters and members of his coalition. "I'd like to put the relationship between Budapest and the government on a new plane. We are readying not for war but for cooperative construction."
"From tomorrow ... we will build a transparent, reputably functioning, Green and solidary city," Karacsony concluded.
Karacsony also lauded the close cooperation between several of the opposition parties, which he said was the only way forward if they wanted to win the 2022 parliamentary elections.
Tarlos, also a former mayor of one of the capital's 23 districts, had been leading Budapest since 2010. Nominally an independent, he ran with the backing of Fidesz and its smaller ally, the Christian Democrats. He was gracious in defeat.
"There's nothing to say. Budapest today made this decision and elected Gergely Karacsony ... and I congratulate him," Tarlos said with Orban standing beside him.
The prime minister emphasized his party's success in rural areas, acknowledged losing the capital and said Tarlos would become his adviser.
"We take note of this result," Orban said. "All we can say is that we are ready to cooperate in the interests of the people living in the country and in Budapest."
Despite the seemingly warm feelings after the vote, Orban made it clear during the campaign that it would be unwise, or even "suicidal" as one of his allies put it, for cities to choose opposition candidates.
Analysts expected him and his party to continue with their combative style, which includes strong anti-migrant policies, increasing domination of the media and a centralized power structure built around the prime minister's sprawling office.
"Based on what they've done since 2010, I don't count on a more moderate or appeasing tone from Fidesz," said analyst Bulcsu Hunyadi at Budapest's Political Capital Institute. "They usually keep moving forward and become even tougher."
Hunyadi said that Fidesz, which still has a two-thirds majority in parliament, could, for example, try to cut back even further on the powers of mayors and municipalities.
"Still, I don't think the lesson for Fidesz in this election is that they have to punish opposition cities," Hunyadi said. "In the current environment, this could backfire on them."
The election campaign was beset by politicians' personal scandals, a novelty in Hungary.
The most commented on were separate secret sex tapes released about two mayors, one from Fidesz - former Olympic champion gymnast Zsolt Borkai - and one from the opposition, Tamas Wittinghoff, the long-time leader of a town near Budapest.
Both men easily won re-election Sunday, although Orban said that on Monday he would reveal his position on Borkai, who could be seen participating in an orgy on a yacht and was also criticized for his business connections and alleged corruption.
While Wittinghoff's video seemingly did not affect the opposition, Borkai's scandal visibly flustered Fidesz and Orban, who casts himself as a defender of Europe's Christian culture and traditional family values.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.