lay in state in a flag-covered coffin at a military academy, bringing the curtain down on a 14-year reign that divided his nation.
"There you are, undefeated, pure, transparent, unique, true, alive forever," political heir Nicolas Maduro said as his voice rose and cracked in a eulogy that both praised his mentor and railed against his opponents.
"Mission accomplished comandante! The struggle goes on," he exclaimed as the guests, ranging from Cuban leader Raul Castro to Hollywood star Sean Penn, applauded in a raucous ceremony filled with music, cheers and chants for Chavez.
Maduro was later sworn in as acting president at the National Assembly and named Chavez's son-in-law Jorge Arreaza vice president before urging election authorities to "immediately" convene elections.
Maduro donned the presidential sash, his voice breaking as he declared: "sorry for these tears but this presidency belongs to our comandante," but the main opposition coalition boycotted the event, saying that it was unconstitutional.
The ceremony set the stage for a bitter election campaign that must be called within 30 days, five months after Chavez beat a stronger challenger than he had been used to -- Henrique Capriles, who will now likely face his former vice president.
"Nicolas, nobody elected you president. The people didn't vote for you, kid," Capriles said. The opposition has argued that the constitution calls for the National Assembly speaker to take over as interim leader.
Before the political battle began, the state funeral opened with Venezuelan conductor and Los Angeles Philharmonic maestro Gustavo Dudamel leading an orchestral rendition of the national anthem.
Maduro placed a replica of the golden sword of South American independence hero Simon Bolivar on his mentor's wooden casket and then handed it to his family at the end of the funeral.
Presidents Mahmoud Ahmadinejad of Iran and Alexander Lukashenko of Belarus sat next to each other, wiping away tears as a band played one of Chavez's favorite sentimental songs.
"We have lost a great leader, a great man," Ahmadinejad said after the ceremony.
"Hugo came from the people and he served the people."
Several Latin American leaders, including Cuba's Castro, were invited to stand in an honor guard around the coffin, which was closed and covered in the yellow, blue and red colors of Venezuela.
The ceremony was interrupted a few times by chants of "Chavez lives, the struggle goes on!"
Chavez's body will lie in state for seven more days and officials said it will be embalmed and preserved "like Lenin" to rest in a glass casket in the military barracks where he plotted a failed coup in 1992.
Foreign Minister Elias Jaua and a crowd of flag-waving Chavez supporters greeted leaders as they arrived at the military academy for the funeral. The crowd chanted "Chavez lives, the struggle goes on!"
Venezuela is giving Chavez a long farewell, with hundreds of thousands of people filing past his open casket nonstop since Wednesday, one day after Chavez lost his two-year battle with cancer at age 58.
Some fainted from the heat, many spent the night outside to see the man who became a hero of the poor and villain of the rich with social programs funded by Venezuela's vast oil wealth.
The doors reopened to the public after the funeral and the casket was half open again, allowing people to once more see his face.
But in a country divided by Chavez's populist style, opinions of his legacy vary, with opposition supporters in better-off neighborhoods angry at the runaway homicide rate, high inflation and expropriations.
"There are no words for what Chavez did: he ruined Venezuela," said Giuseppe Leone, a 78-year-old Venezuelan-Italian in the well-to-do east of the city.
Leaders from Africa and the Caribbean attended the funeral, but European nations sent lower-level delegations, while the United States was represented by its charge d'affaires and two politicians from President Barack Obama's Democratic Party.
Although he expelled two US military attaches earlier this week, accusing them of plotting to destabilize Venezuela, Maduro welcomed US Representative Gregory Meeks of New York and former congressman Bill Delahunt of Massachusetts.
"We love all people of the Americas. But we want relations of respect, of cooperation, of true peace," he said, calling for a world "without empires."
US civil rights leader Jesse Jackson gave a prayer, urging God to "heal the breach between the US and Venezuela."
Under Chavez, Venezuela's oil wealth underwrote the Castro brothers' communist rule in Cuba, and he repeatedly courted confrontation with Washington by cozying up to governments that shared his "anti-imperialist" worldview.
Maduro said Chavez's body will be taken to the "Mountain Barracks" in the "January 23," a public housing project that was a bastion of Chavez support. The barracks will be converted into a Museum of the Revolution.
It was there that Chavez spearheaded what proved to be a failed coup against then-President Carlos Andres Perez on February 4, 1992. His arrest turned him into a hero and led to his first of many election victories in 1998.