President Nicolas Maduro has survived the first major test of his seven-month presidency, after the ruling Socialists won a majority of votes in Venezuela's local elections.

The 51-year-old hand-picked heir of the late leftist Hugo Chavez was in the crosshairs of the country's opposition, as a deeply divided electorate confirmed the Socialists as remaining Venezuela's strongest party.

The centre-right opposition won in five of the country's most populous cities, including Caracas, the oil city of Maracaibo, and Barinas, Chavez's birthplace.

"The Venezuelan people have told the world that [the] Bolivarian Revolution continues with even more force," Maduro told crowds at an outdoors post-vote rally in Caracas.

Maduro's Socialists won nearly 50 percent of the overall vote against 43 percent for the opposition, Tibisay Lucerna, National Electoral Council president, said, with nearly all of the polling stations reporting.

The vote results send a "very clear message", Henrique Capriles, the Venezuelan opposition leader, said.

"Venezuela is a divided country, it has no owner. We are building an alternative and will not rest until Venezuela is united."

Capriles alleged that the vote was marred by scores of problems at polling stations, including broken machines.

Approval ratings for Maduro - a former bus driver, leftist stalwart and cabinet minister - were plunging when, in November, the National Assembly granted him power to rule by decree for one year to fight corruption and respond to what he has called an "economic war" unleashed by the opposition with US support.

He quickly unveiled a series of measures to force price cuts, notably on household appliances and cars, and threatened speculators with prison.

Pre-election surveys showed that Venezuela's middle class welcomed this populist show of force from Maduro, a self-styled "avenging president".