The charismatic leader won the loyalty of the impoverished with his socialist revolution, but he left the nation deeply divided and did little to help it develop, analysts say.

CARACAS, Venezuela —Venezuelan President Hugo Chavez, the charismatic socialist whose Bolivarian Revolution reduced poverty and galvanized anti-American sentiment across Latin America but left his nation deeply polarized and ever more dependent on oil dollars, died Tuesday in Caracas after a nearly-two-year battle with cancer. He was 58.

Vice President Nicolas Maduro announced the passing on national television, saying that Chavez had died at 4:25 p.m.

His death followed repeated treatments for pelvic cancer in Cuba, the country of his idol Fidel Castro, where his condition was first diagnosed in June 2011.

Although Chavez finally disclosed the gravity of his illness in December after months of insisting he was cancer-free, news of his death was expected to shake his bedrock supporters, Venezuela's poor. They were the biggest beneficiaries of his 14 years in power, a period in which opponents in the country's middle class and elite said he grew increasingly iron-fisted and autocratic.

Chavez returned home from Cuba on Feb. 18 following his most recent surgery and remained out of sight at a military hospital in Caracas. Though he had been scheduled to be sworn in for a fourth term on Jan. 10, the Venezuelan Supreme Court ruled he did not need to take the oath of office to remain president, a decision questioned by legal scholars.

His popularity with the poor helped propel him to victory in October balloting, gaining 55% of the vote despite rising crime, persistent scarcities of basic food items, double-digit inflation and unpopular foreign aid programs. His reelection was a testament to the near-religious devotion of Venezuela's impoverished to their comandante.

Chavez won the lower classes' support by redistributing the nation's vast oil wealth through welfare programs called missions, which set up medical clinics and schools, operated a chain of cut-rate grocery stores, and divvied up nationalized farms and ranches among cooperatives of the impoverished.

Daniel Hellinger, a political science professor at Webster University in St. Louis, said the welfare programs reduced Venezuela's poverty rate from close to 80% in the 1990s to about 20%, and wiped out illiteracy.

"To millions of poor Venezuelans excluded from meaningful participation in politics, Chavez offered hope for a new kind of democracy that would open doors of government to them," Hellinger said. "However much the system fell short of that aspiration, it was Chavez who gave voice to it."

Chavez maintained his link to the poor partly through his weekly "Alo Presidente" television show, during which he performed much like a televangelist spreading the gospel of his revolution.

But opponents criticized Chavez for concentrating power in the style of a classic Latin American caudillo, or military dictator. Although he was democratically elected four times, and won several nationwide referendums, he closed TV and radio stations critical of him, armed a civilian militia and brought the bureaucracy under close control, detractors said.

Chavez nationalized scores of energy, banking and telecommunications companies in addition to more than 1 million acres of farmland. That caused a steep decline in Venezuelan investment and productivity and made the nation ever more dependent on oil sales.

Despite the vast sums Venezuela collected over the last decade from its energy reserves, Chavez was forced to borrow more than $38 billion from the Chinese in the final years of his presidency to finance his domestic welfare and foreign aid programs. The loans are secured by future commitments to sell oil to Beijing.

"The poor have had more money to spend, but it's come at a great price," said Jeffrey Davidow, a former U.S. ambassador to Venezuela. "The money should have been put to productive use in industry, housing or education. So, in the long run, it hasn't been of much help to Venezuelans."

Chavez's influence extended far beyond Venezuela's borders. He roused Latin American opposition to the so-called Washington Consensus that developing nations should open their markets to free trade and foreign investors. He called President George W. Bush a terrorist for invading Afghanistan and the "devil" during a United Nations speech. He forged close links with other leftist leaders in the hemisphere, including Bolivia's Evo Morales and Nicaragua's Daniel Ortega.

That Chavez sought cancer treatment in Cuba was no coincidence. Chavez revered Castro and saw the Cuban revolution as a model for Venezuela. He gave generously to Cuba's shaky socialist state, reportedly supplying the nation with 100,000 barrels of crude per day at cut-rate prices. In exchange, Cuba sent 12,000 doctors, athletic trainers and security personnel to Venezuela.