Vice President Nicolas Maduro said the surgery was both "complex" and successful. Maduro made the announcement on Venezuelan television, flanked by other Chavez aides and military commanders.
It was the fourth cancer-related operation that Chavez has undergone since June 2011.
Three days before the surgery, Chavez had announced that he needed to have surgery again after tests showed "some malignant cells" had reappeared in the same area of his pelvic region where tumors were previously removed.
During the surgery, close Chavez ally Tareck El Aissami had said on television: "Everything is going well."
On the streets of Caracas, Venezuelans on both sides of the country's deep political divide voiced concerns about Chavez's condition and what might happen if he ultimately doesn't survive his illness.
"It's difficult to think about Venezuela without Chavez," said Rafael Perdomo, a mechanic who has supported the president since 1998, when he first ran for the presidency. "I fear that we, the poor, could lose everything if Chavez dies."
Chavez recently said for the first time that if his illness cuts short his presidency, Vice President Nicolas Maduro should take his place and be elected president to continue on with his socialist movement. But Perdomo said he doesn't trust Maduro the way he trusts Chavez.
Some government supporters held a prayer meeting in a Caracas plaza while the surgery was under way, joining hands and singing hymns. Some held up posters of Chavez as they sang.
"We ask God, to allow him to live," said Carmen Romero, who participated in the gathering.
Others Venezuelans said that while they're sorry about Chavez's health situation and wish him the best, it isn't a particular concern for them. Many were out buying Christmas gifts and shopping for food ahead as they prepared for the holiday season.
"I'm sorry about what is happening to the president, but for many of us life goes on," said Maria Colmenares, a housewife and opposition supporter, as she left a supermarket with bags of groceries and stood on a street corner waiting for a taxi.
"I feel pity for Chavez and his people, especially the Chavistas because they have put all their hopes in the president and they know that nobody is capable of replacing Chavez," Colmenares added. "None of Chavez's collaborators have his charisma."
Chavez received a flurry of get-well messages from leaders across Latin America, including the presidents of Chile, Peru and other countries. Ecuadorean President Rafael Correa, who visited Chavez in Havana on Monday, said his ally was undergoing a "very delicate operation."
"He's passing through one of the hardest moments of his life. Our heart and our solidarity are with a historic president," Correa said at an event on Tuesday in the Ecuadorean city of Tulcan.
Chavez had said the surgery would present risks. But afterward Maduro said that Chavez had been moved to a room to recover and begin "special treatments."