With about 90 percent of votes counted, Chavez had more than 54 percent of the vote, and Capriles had 45 percent, National Electoral Council president Tibisay Lucena said. She said 81 percent of the nearly 19 million registered voters cast ballots, one of the largest turnouts in years.
It was Chavez's third re-election victory in nearly 14 years in office, though by a smaller margin than in 2006, when he won 63 percent of the votes.
Fireworks exploded in downtown Caracas, and Chavez's supporters celebrated waving flags and jumping for joy outside the presidential palace.
Chavez won more than 7.4 million votes, beating Capriles by more than 1.2 million votes, Lucena said.
Capriles congratulated Chavez and told his supporters not to feel defeated.
"We have planted many seeds across Venezuela and I know that these seeds are going to produce many trees," he told supporters in a speech late Sunday.
Chavez spent heavily in the months before the vote, building public housing and bankrolling expanded social programs providing benefits to poor families.
Capriles, a youthful state governor, became a strong challenger after winning a February primary and rallied an opposition that grew more united and better organized than in the past. But in the end, it was no match for Chavez's electoral prowess.
Just as polls closed on Sunday night, hundreds of young red-shirted Chavistas took to the streets on motorcycles and said they were ready to begin celebrating.
"Let them accept defeat," Kleiver Gutierrez said of the opposition.
People holding posters of Chavez shouted to passing cars outside the Miraflores presidential palace.
One pro-Chavez voter, private bodyguard Carlos Julio Silva, said that whatever his faults, Chavez deserved to win for spreading the nation's oil wealth to the poor with free medical care, public housing and other government largess. The country has the world's largest proven oil reserves.
"There is corruption, there's plenty of bureaucracy, but the people have never had a leader who cared about this country," Silva said after voting for Chavez at a school in the Caracas slum of Petare. "That's why the people are going to re-elect Hugo Rafael Chavez Frias."
At many polling places, voters began lining up hours before polls opened at dawn, some snaking for blocks in the baking Caribbean sun. Some shaded themselves with umbrellas. Vendors grilled meat and some people drank beer.
Maria Leonis was selling CDs of Chavez's campaign theme music on a sidewalk next to a polling center. "Today I've sold about 100 CDs, just Chavez's song," Leonis said, adding that she supported Chavez because "I want to keep seeing change."
Chavez's critics say the president has inflamed divisions by labeling his opponents "fascists," ''Yankees" and "neo-Nazis," and it's likely hard for many of his opponents to stomach another six years of the loquacious and conflictive leader.
Some said before the vote that they'd consider leaving the country if Chavez won.
Gino Caso, an auto mechanic, said Chavez is power-hungry and out of touch with problems such as crime. He said his son had been robbed, as had neighboring shops.
"I don't know what planet he lives on," Caso said, gesturing with hands blackened with grease. "He wants to be like Fidel Castro - end up with everything, take control of the country."
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 contest ever.
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.