Chavez's critics said the president has inflamed divisions by labeling his opponents "fascists," ''Yankees" and "neo-Nazis," while Chavez's loyalists alleged Capriles would halt generous government programs that assist the poor.
"I'm really tired of all this polarization," said Lissette Garcia, a 39-year-old clothes seller and Capriles supporter who voted in the affluent Caracas district of Las Mercedes. "I want to reconnect with all my friends who are 'Chavistas.'"
Violence flared sporadically during the campaign, including shootings and rock-throwing during rallies and political caravans. Two Capriles supporters were shot to death in the western state of Barinas last weekend.
Troops guarded thousands of voting centers across the country.
Defense Minister Henry Rangel Silva said as he voted that all had been calm and he hoped that would continue. He said if any groups try to "disturb order, they should know there is an armed force prepared and equipped and trained ... to put down any attempt at disturbances."
He didn't identify the groups to which he was referring.
Chavez's opponents mounted a noisy protest in Caracas and other major cities Saturday night, beating pots and pans from the windows of their homes to show displeasure with the president — and also their hopes for change. Drivers on downtown streets honked horns, joining the din.
The 40-year-old Capriles, a wiry former governor affectionately called "Skinny" by supporters, infused the opposition with new optimism, and opinion polls pointed to him giving Chavez his closest election.
Some recent polls gave Chavez a lead of about 10 percentage points, while others put the two candidates about even.
Chavez spoke little during the campaign about his fight with cancer, which since June 2011 has included surgery to remove tumors from his pelvic region as well as chemotherapy and radiation treatment. He has said his most recent tests showed no sign of illness.
"Chavez is going to fight until his last breath. He doesn't know how to do anything else," said Antonio Padron, a bank employee backing the president. Padron expressed optimism that the 58-year-old Chavez would win but predicted a close finish: "It's a tough fight. The opposition has never been this strong."
Chavez won the last presidential vote in 2006 with 63 percent of the vote.
A former army paratroop commander first elected in 1999, Chavez has presided over an oil boom and has spent billions of dollars on social programs ranging from cash benefits for single mothers to free education.
But he has suffered declining support due to one of the world's highest murder rates, 18 percent inflation, a deteriorating electrical grid and a bloated government accused of endemic corruption and mismanagement.
While his support has slipped at home, Chavez has also seen his international influence ebb since he emerged in the mid-2000s as leader of a like-minded club of newly elected Latin American leftist presidents.
Chavez accumulated near-absolute power over the past decade thanks to his control of the National Assembly, pliant institutions such as the Central Bank and friendly judges.
Capriles said Chavez has stirred up hatred, hobbled the economy by expropriating private businesses and squandered oil wealth. He criticized Chavez's preferential deals supplying oil to allies, including one that lets Cuba pay with the services of Cuban doctors.
At one voting center in western Zulia state, in the municipality of Santa Rita, voters said some people had actually formed two separate lines — one with Chavez supporters and the other with Capriles supporters. Elsa Gutierrez, a housewife and Capriles supporter, said it was wrong to have two lines and feared it could lead to conflicts.
"This situation can't be permitted," Gutierrez said, adding that she voted for Capriles "because I want this division in my country to end."
Political analyst Ricardo Sucre said he expected the election to show "two halves, more or less even." Regardless of the result, he said, Venezuelans are likely to remain deeply divided by politics for years to come.
Associated Press writers Fabiola Sanchez, Christopher Toothaker, Jorge Rueda and Vivian Sequera contributed to this report.
Ian James on Twitter: http://twitter.com/ianjamesap
Frank Bajak on Twitter: http://twitter.com/fbajak
- Weighing in: The top 20 metro areas with the...
- Doctor helping downed pilot is shocked to...
- 17 years later, parents find kidnapped...
- Obama: Racial bias in Ferguson police dept...
- 50 things about 'The Sound of Music' to help...
- APNewsBreak: Ringling Bros. eliminating...
- Russian priest feels closer to God in...
- Eating toothpaste and doing doughnuts on the...
- Israel's Netanyahu warns US 'bad deal'... 74
- Clinton used personal email account as... 29
- AP EXPLAINS: Supreme Court case against... 26
- Obama: Racial bias in Ferguson police... 26
- Supreme Court justices sharply divided... 21
- Kerry tries to dampen fuss over Israeli... 17
- Personal email account revives old... 15
- US clears officer in Ferguson case,... 15