Helping the opposition were voter disenchantment with rising crime and Latin America's high inflation rate.
|Chavez's older brother was in a tight race to succeed their father in their home state [AFP]
The mixed results also triggered a public relations battle as both sides fought to seize the momentum by portraying themselves as the real winner.
Leopoldo Lopez, a young opposition leader who the government had reportedly blocked from standing in the polls, said the election showed Venezuelan politics had finally shifted after years of Chavez's dominance.
"The main lesson from the election is that there is a sentiment of plurality among voters that is over and above the government and the opposition," he said.
"We need to build an alternative for a different Venezuela that brings people together in the centre."
Teresa Bo, Al Jazeera's correspondent reporting from Caracas, said that accusations of fraud had plagued the campaign but international observers said that the voting process was normal.
The polls were as a test for Chavez against an energised opposition.
|Chavez remains Venezuela's most
popular politician [AFP]
His allies swept the last state elections in 2004, winning all but two of 23 governorships and a majority of local offices.
This time candidates competed for 22 governorships, 330 mayoral posts and other offices.
Chavez remains the country's most popular politician and enjoys overwhelming control of local offices.
His popularity has rebounded since he suffered his only electoral defeat in 2007 in a referendum that would have allowed him to seek re-election indefinitely.
Chavez is keen to lay the groundwork to extend his rule beyond 2013, when his six-year term ends.
But the setbacks in some states could force Chavez to contend with hostile opponents with revived national clout.
Candidates included Chavez's older brother Adan, who was in a tight race to succeed their father as governor of Barinas, Chavez's home state.
Chavez's ex-wife Marisabel Rodriguez was also on the ballot but on the opposition side.
Rodriguez, running for district mayor in her hometown, Barquisimeto, said her campaign may have been local but it was also "against the danger posed to democracy by leaving a single person in power for a long time".