JOHANNESBURG (Reuters) - South Africa's main opposition party on Monday won control of the local government in Johannesburg, the country's economic hub, unseating the ruling party, which has run the municipal council since apartheid ended 22 years ago.

The victory gave the Democratic Alliance control of both Johannesburg and Pretoria, the nation's capital, following heavy losses in urban areas by the ruling African National Congress at the Aug. 3 local elections.

By taking over the two major cities, the DA has reshaped the political landscape in South Africa, where the ANC has ruled unopposed since it ended white-minority rule in 1994.

"We going to bring change that is going to bring jobs to our people. Let's get this city working again," said new mayor Herman Mashaba, a black businessman.

The ANC took 45 percent of the vote to the DA's 38 percent in the elections - short of an outright majority. The DA rallied smaller parties to back Mashaba, who won by 144 votes to 125 for the former mayor, ANC's Parks Tau. The leftist Economic Freedom Fighters became the kingmaker when it came third in the city.

The DA last week took over the municipality that includes the capital, Pretoria, and Nelson Mandela Bay, which includes manufacturing hub Port Elizabeth, also with the support of smaller parties.

The DA has been running the local government in Cape Town, where parliament is situated, since 2006.

The ANC still won the most votes overall during the election, and was working to form coalitions in the municipalities where it lost its majority.

(Reporting by James Macharia, editing by Larry King)