Maduro and Bolivian President Evo Morales, one of Chavez's staunchest allies, mingled with the crowd, and at one point both fell to the ground in the jostle of bodies pushing in every direction.
Military officers and Cabinet members ringed the president's coffin, stone-faced. Other mourners pumped their fists and held aloft images of the late president, amid countless yellow, blue and red Venezuelan flags.
"The fight goes on! Chavez lives!" the mourners shouted in unison, many through eyes red from crying for long hours.
Chavez's mother, Elena Frias de Chavez, leaned against her son's casket, while a priest read a prayer before the procession left the military hospital where Chavez died at age 58.
People who passed by the glass-topped coffin said Chavez's body was clad in the presidential sash and the military uniform and red beret of his days as a paratrooper.
Ricardo Tria, a social worker, said he waited nearly four hours to pass by the casket. Chavez looked "asleep, quiet, serious," he said.