Turkey’s opposition supporters partied long into the night after their candidate for Istanbul mayor beat a rival backed by long-time President Recep Tayyip Erdogan.

The streets were transformed into an impromptu caravan of cars honking their horns, with overjoyed passengers leaning out of windows as they cheered and waved Turkish flags.

The party eventually died down and the main question Monday is what political newcomer Ekrem Imamoglu’s win in Turkey’s biggest city means for Mr Erdogan, and whether this is finally the opposition’s moment for a serious challenge to his rule.

Turkey Istanbul Election
Ekrem Imamoglu savours his win in Istanbul’s mayoral election (Onur Gunay/AP)

The opposition has been spent nearly two decades in the shadows as Mr Erdogan’s strengthened his hold on power.

Mr Imamoglu narrowly won the vote for Istanbul mayor in March, but the vote was controversially cancelled because of procedural irregularities.

The repeat vote, however, was resoundingly in his favour: Mr Imamoglu garnered 54%, beating the government candidate Binali Yildirim who tallied 45%.

The landslide win fuelled speculation that Mr Erdogan and his Islamic-leaning Justice and Development Party, AKP, may be facing a real challenge after blitzing his opponents with successive election victories since it first came to power in 2002.

Turkey Istanbul Election
Turkey’s President Recep Tayyip Erdogan casts his ballot at a polling station in Istanbul (Emrah Gurel/AP)

“Erdogan is likely to face not only an emboldened opposition but also more open dissent within the AKP itself,” said Wolf Piccoli of the New York-based risk analysis firm Teneo Intelligence.

“The victory of Ekrem Imamoglu … is the most serious setback for Erdogan since his Justice and Development Party first took office in November 2002 and will further fuel the already growing sense amongst both his opponents and many members of his own party that his career is now in irreversible decline.”

The vote count was officially ratified on Monday.

But Mr Yildirim conceded within minutes after the first returns were announced, and tens of thousands of opposition supporters flocked to a square in an Istanbul suburb late Sunday to greet Mr Imamoglu, chanting his campaign slogan: “Everything will be great!”

Turkey Istanbul Mayor
A poster of Binali Yildirim, the losing mayoral candidate of the ruling Justice and Development Party is seen on a building near Golden Horn in Istanbul (Burhan Ozbilici/AP)

Mr Erdogan rose to prominence as the mayor of Istanbul in the mid-1990s and dominated national politics following a 2001 financial crisis that wiped out much of the political establishment.

He presided over years of growth, but in the past year the economy has been in-and-out of recession, with the country plagued high borrowing costs and sovereign downgrades.

The repeat election also heightened public anxiety over the style of government rule that critics describe has become increasingly authoritarian.

Opposition supporter Banu Kirmizigul said he only voted in the repeat election, inspired by Mr Imamoglu’s campaign.

Turkey Istanbul Election
Supporters of Ekrem Imamoglu, the candidate of the secular opposition Republican People’s Party, CHP, light up a flare as they celebrate (Lefteris Pitarakis/AP)

“I am really happy and my faith in this country has been restored,” he said.

“I saw that our people had awakened and I decided to wake up now, and I cast my vote. We (the opposition) got 800,000 more votes.

“We were successful and I am very happy.”

Turkey Istanbul Election
Ekrem Imamoglu savours his win (Onur Gunay/AP)

Turkey’s borrowing rates eased as the repeat election ended months of political uncertainty.

The yield on Turkey’s 10-year government bond eased to 15.3% after touching 20% in mid-May.

A group of election monitors from the Council of Europe, a Strasbourg-France based organisation aimed at holding members states accountable for their human rights commitments, said Sunday’s election had been held “competently and in compliance with the applicable rules.”