Though his margin of victory was much narrower than in past elections, he still won handily. With 90 percent of the votes tallied, Mr. Chávez received 54 percent, to 45 percent for his opponent, Henrique Capriles Radonski, the national election council said. Fireworks erupted in Caracas after the news, and Chávez supporters celebrated in the streets.
Shortly before 11:30 p.m. local time, Mr. Chávez stepped out onto the balcony of the presidential palace in Caracas and waved to a sea of jubilant supporters. “My words of recognition go out from here to all who voted against us, a recognition for their democratic temperament,” he said. A former soldier, he called the election a “perfect battle.”
Still, after a spirited campaign, the polarizing Mr. Chávez finds himself governing a changed country. He is an ailing and politically weakened winner facing an emboldened opposition that grew stronger and more confident as the voting neared, and held out hope that an upset victory was within reach.
Mr. Chávez has said that he would move forward even more aggressively to create his version of socialism in Venezuela in a new six-year term, although his pledges were short on specifics.
His health, though, remains a question mark. He has undergone several rounds of treatment for cancer in the last 15 months, but has refused to make public essential details of his illness. If he overcomes the disease and serves out his new term to its end in 2019, he will have been in power for two full decades.
Toward the end of the campaign, facing pressure from Mr. Capriles, he pledged to make his government more efficient and to pay more attention to the quality of government programs like education. He even made appeals for the middle class and the opposition to join in his revolution.
But Mr. Chávez spent much of the year insulting and trying to provoke Mr. Capriles and his followers. And on Sunday night, he had to face the fact that the people he taunted as squalid good-for-nothings, little Yankees and fascists, turned out to be nearly half the electorate.
As the opposition’s momentum grew, Mr. Chávez’s insults seemed to lose their sting. By the end of the campaign, young people in Caracas were wearing colorful T-shirts that said “majunche” or good-for-nothing, Mr. Chávez’s favorite taunt.
Mr. Capriles was subdued on Sunday night, congratulating Mr. Chávez and saying he hoped the president would see the result as “the expression today of a country with two visions, and to be president means working to solve the problems of all Venezuelans.”
He appeared poised to carry on his fight in the elections for state governors in December. “You should all feel proud, do not feel defeated,” he told supporters.
Michael Shifter, president of the Inter-American Dialogue, a research institute in Washington, called the presidential election “a fundamental turning point.” He said Mr. Chávez was “going to have to deal with a very different society than he dealt with in his last term, a society that’s awakened and more organized and more confident.”
Even so, the opposition is a fragile coalition with a history of destructive infighting, especially after an election defeat. Mr. Capriles will have to keep this fractious amalgam of parties from the left, right and center together in order to take advantage of the new ground they have gained.
“The opposition has more power, it feels more support,” said Elsi Fernandes, a schoolteacher, who voted for Mr. Capriles on Sunday morning in Catia, a poor neighborhood in Caracas. “The difference is that we’re not going to stay with our arms crossed.”
The turnout was more than 80 percent, the highest in decades, the election council said. People stood in line for hours, although the voting appeared in most cases to run smoothly.