By Bulelani Phillip and Philda Essop
Helen Zille is the new mayor of Cape Town after a dramatic last-ditch bargaining frenzy that propelled the DA into power. She beat the ANC's Nomaindia Mfeketo to the city's top job by 106 votes to 103 - with one spoilt ballot.
Applause broke out in the council chamber as new speaker Jacob Derek Smit of the Freedom Front Plus announced the result.
As the mayoral chain was placed around her neck, an ecstatic Zille said the outcome proved South Africa was a maturing democracy.
"I am so honoured that so many people put their trust in me and I am honoured to accept the position."
Speaker Smit, who was nominated by the Universal Party, also got the nod by a single vote, with 105 votes to the ANC's Gavin Paulse's 104, with one spoilt ballot.
As the tension mounted, Mfeketo dashed off an SMS to Smit, who is known as Dirk, and to the Universal Party's Martin Fienies, who had nominated him for the post. It read: "You can't leave me now."
It fell on deaf ears: Smit got the job.
Early voting patterns had suggested the DA, with 90 seats, had won the support of the ACDP, with seven seats, the Africa Muslim Party, 3, the UDM, 2, and one each from the FF Plus, United Independent Front and the Universal Party.
The PAC abstained, while the the ID, with 23 seats, sided with the ANC, which won 81 seats in the March 1 election.
The ID had earlier put forward Leon van Rensburg of the DA as speaker, but he declined the nomination.
Since the election, the horse-trading has continued non-stop until Wednesday's tension-filled meeting, since no party has an outright majority.
For the past two weeks, the battle for control of the Mother City had been on a knife-edge, with alliances seeming to shift day by day and hour by hour.
The bargaining went down to the the wire, with the Africa Muslim Party (AMP) finally giving its three councillors a free vote in deciding which mayoral candidate they would support.
The ACDP backtracked from a coalition with the ANC and the ID and threw its support behind Zille.
Only on Tuesday ANC sources close to the negotiations were confident their party would continue running the city in coalition with the ID and the AMP .
Both Zille and ANC candidate Nomaindia Mfeketo looked tense as officials counted and recounted ballots.
ID leader Patricia de Lille, sitting in the public gallery, was constantly on her cellphone giving orders.