"The election of [Helen] Zille as chair of federal council is victory for people who are opposed to my belief systems."
Black leaders within the DA believe that the liberal, multi-racial party is going back to its roots of being an all-white organisation, the BBC's Milton Nkosi in Johannesburg reports.
Mr Mashaba also said the government's "pro-poor agenda" has been "undermined, criticised and rendered nearly impossible" by the DA. Our reporter says that by "pro-poor", Mr Mashaba means "pro-black".
As the first non-ANC (African National Congress) mayor of South Africa's biggest city since the end of white minority rule in 1994, Mr Mashaba's election victory in 2016 signalled a major success for the DA.
Self-made businessman Mr Mashaba was seen as a key ally of the party's first black leader, Mmusi Msimane, in his efforts to increase support among black voters.
But the DA's share of the vote dropped in the May general election after conservative whites abandoned the party, and Ms Zille's return to a senior post in the party is seen as an attempt to regain their support.
Mr Mashaba said he would step down next month, raising questions about whether the DA would be able to retain the mayoral post in Johannesburg.
'Manna from heaven for their rivals'
Milton Nkosi, BBC News, Johannesburg
News of Herman Mashaba's resignation exposes deep fault lines within the DA. It's a far cry from the day when Mmusi Maimane was elected party leader amid much fanfare, his hand clasped by Helen Zille's as they sang along to loud cheers of delegates.
For the governing ANC, which is itself trapped in seemingly perpetual internal squabbles, the opposition DA's problems are manna from heaven.
The ANC is weak but the largest opposition party in the country is mutilating itself in a corner, unprovoked.
As for the DA party leader Mr Maimane, he is also fighting for his political life.
Standing side-by-side with Mr Mashaba at Monday's press conference, Mr Maimane held his hand high saying:" "You are my hero! You are my hero!"
Mr Maimane's fate will be decided in next year's party leadership congress. But judging by the speed at which events are unfolding, there is no guarantee that he will still be around then.