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
- The brave man who may have risked his life in...
- Living on $2 a day: the new face of extreme...
- Hillary Clinton slams Trump in front of his...
- Republican lawmaker seeks ban on LGBT...
- Bill Plaschke: Pat Haden, USC shouldn’t...
- Dutch Safety Board: Buk missile downed MH17...
- A tale of two cities: Norwegian towns offer...
- More cities are recognizing Native Americans...
- Republican lawmaker seeks ban on LGBT... 27
- More cities are recognizing Native... 26
- Obama: Clinton made mistake; security... 22
- Gun violence researchers becoming an... 19
- Living on $2 a day: the new face of... 19
- Obama touts immigration reform in... 17
- Obama: Americans must 'come together'... 17
- Rep. Jason Chaffetz says he wouldn't... 15