The National Electoral Council in Venezuela says the governing United Socialist Party won the greatest share of the vote in municipal elections on Sunday.
With most votes counted, the PSUV had 49% while the opposition has about 43%.
The opposition were ahead in most of the larger cities, including the capital, Caracas, while the governing party won in rural areas.
The BBC reports the elections were seen as a test for President Nicolas Maduro who became president in April, after the death of Hugo Chavez.
In November, the National Assembly gave him powers to govern by decree. The opposition accuses him of failing to deal with crime, inflation and a shortage of basic goods.
Voters were electing mayors to 337 municipalities and officials to more than 2,000 city councils. The opposition won mayoral races in the capital, Caracas, and the second city, Maracaibo.
Electoral officials said on Monday evening that the PSUV had won in 196 of the municipalities being contested, while the opposition took 53, and independents another eight.
President Nicolas Maduro called the results a "grand victory", telling supporters at a rally in Caracas that "the Bolivarian Revolution continues now with more strength".