CARACAS, Venezuela (CNN) -- Candidates from Venezuelan President Hugo Chavez's party won a majority of the seats Sunday in local elections that were seen as a test of Chavez's influence.
President Hugo Chavez has been campaigning hard for what he calls "my candidates."
The opposition, however, chalked up some important wins, including the mayor's office in the capital, Caracas, and the governorship in two populous states. Voter turnout reached a historic 65 percent, the National Electoral Council said.
Pro-Chavez candidates won the gubernatorial races in 17 of 22 states. The opposition win included the populous states of Miranda and Zulia.
"There is a categorical success," Chavez told reporters after the results were announced. "Today, it is Venezuela's victory, and it is ratified the democratic party that people have chosen."
Sunday's elections were the first since Venezuelans shot down a referendum that would have allowed Chavez to run for his third six-year term. Major losses by his ruling PSUV party would have deeply damaged any effort to place the referendum on the ballot again.
"In the final tally," political analyst Luis Vicente Leon told CNN in a recent interview, "it's not the election of governors and mayors that he is looking for.
"He is looking to show the country an electoral triumph to wipe a little of the egg off his face from his defeat in the constitutional referendum, starting with the premise that President Chavez desperately needs to have another referendum to have continuous re-election."
A loss for Chavez's party also would have weakened him at a time when he has suffered several defections from his Fifth Republic Movement.
Before the elections, Chavez said in speeches -- in which he called opponents "thieves" and "capos" -- that his 10-year-old government's fate was at stake.
"If we do everything we have to do and we don't leave one single vote for Chavez out of the ballot box, we could win all the states in Venezuela," he said at a boisterous rally last week.
Political analyst Nelson Merentes said winning a majority of the mayor's and governor's races is the fastest and easiest way for Chavez to continue his socialist revolution.
At stake Sunday were 22 governorships, 328 mayor's posts and more than 200 legislative seats.
Analysts paid particular attention to Chavez' home state of Barinas, where his older brother, Adan, ran for governor. He won.
A loss in that race would have caused "President Chavez much symbolic damage because he would be losing in the cradle of his revolution and around his family," said Leon, who is with the Datanalisis polling firm.
Although Chavez has said he will honor all election results, he also has made statements that the opposition sees as threatening.
Speaking in Carabobo state before the elections, Chavez said, "If you allow the oligarchy to return to governing, maybe I will end up taking my tanks from the armored brigade to defend the revolutionary government."
CNN's Patricia Janiot and Journalist Maria Carolina Gonzalez contributed to this report.