With most votes counted, the USP has 49% while the opposition has about 43%.
The opposition was ahead in most of the larger cities, including the capital, Caracas, while the governing party won in rural areas.
The elections have been seen as a key test for President Nicolas Maduro, who replaced the late Hugo Chavez in April.
Since November, Nicolas Maduro has been ruling by decree, promising to tackle corruption and control price rises.
The opposition accuses Nicolas Maduro of failing to deal with crime, inflation and a shortage of basic goods.
Local elections in Venezuela are usually low key, but this one was filled with expectations for the government and the opposition.
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 country’s second city. Maracaibo. They also won the capital of Barinas, from where former Hugo Chavez hailed.
So far, the USP has won in 196 of the municipalities being contested, while the opposition took 53, and independents another eight. The remainder have yet to be declared.
Nicolas Maduro called the results a “grand victory”, telling supporters at a rally in Caracas that “the Bolivarian Revolution continues now with more strength”.
The opposition’s failure to win a majority of the votes cast or significantly increase the number of municipalities under its control from the 46 won in the 2008 local elections was a disappointment to its leader Henrique Capriles.
Sunday’s elections coincided with the anniversary of Hugo Chavez’s famous speech in which he announced that his cancer had returned and named Nicolas Maduro as his preferred successor.
iRGPn5SwiqcImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…