HAVANA — China's president signed trade deals with communist ally Cuba and agreed to help it modernize its ports and hospitals on Tuesday, part of a Latin America trip on which Chinese businessmen have been snapping up raw materials.

HAVANA — China's president signed trade deals with communist ally Cuba and agreed to help it modernize its ports and hospitals on Tuesday, part of a Latin America trip on which Chinese businessmen have been snapping up raw materials.

Taking the long view at a time of financial crisis, China is investing heavily in commodity-producing countries, and Cuba is no exception. More than a dozen deals agreed to by President Hu Jintao included purchases of Cuban nickel and sugar, along with pledges to send food and building materials to help the Caribbean nation recover from three major hurricanes.

Hu signed off on a second, $70 million phase of $350 million in Chinese credit to renovate Cuban hospitals. China also committed to help renovate Cuba's crucial, but aging, ports.

It was unclear how many of the deals were on credit. Havana has already borrowed extensively from Beijing — loans it might have trouble repaying as it recovers from Hurricanes Gustav, Ike and Paloma, all of which hit Cuba this year.

Hu thanked Cuba for sending doctors to China after last year's devastating earthquake, and for educational programs on the island attended by about 2,000 Chinese, including medical students.

China's president also met with ailing former President Fidel Castro. Cuba released a photo of the pair shaking hands and chatting. Hu wore a business suit and the former Cuban president had on exercise clothing that has become his standard uniform since undergoing emergency intestinal surgery and disappearing from public view in July 2006.

Cuban authorities provided no further details, but China's official Xinhua News Agency said the two held a long discussion.

"I see in person that you have recovered and have been energetic, so I feel very pleased," Xinhua reported Hu told Castro.

Castro replied: "We are old friends. I am happy to see that you are as energetic as when I met you last time."

Hu met with Castro during his first visit to Cuba in 2004. The 82-year-old has an undisclosed illness and brother Raul Castro, five years his junior, formally succeeded him as president in February.

Accompanying Hu on a visit to a school for Chinese students on Tuesday, Raul Castro sang snippets of a song about China and Mao Zedong he said he learned while traveling the world in 1953. At first, hundreds of students gathered in an auditorium seemed confused, but they soon sang along, clapping in time.

"Even though the physical distance that separates China and Cuba is great, friendship between both people goes back a long way," Hu said.

Cuba depended heavily on Soviet largesse and turned a cold shoulder to China during the Cold War's Sino-Soviet split. But ties warmed after the breakup of the Soviet Union in 1991, and Cuba now has no problem dealing with both Beijing and Moscow.

With bilateral trade topping $2.6 billion a year, China is Cuba's No. 2 trading partner after Venezuela, where socialist President Hugo Chavez provides nearly 100,000 barrels of oil a day to the island at favorable prices.

The ties have brought a tangible benefit to residents of the Cuban capital, where more than 3,000 shiny new Yutong buses replaced smoke-belching, Soviet era buses.

But Hu's visit poses something of an ideological challenge, since some Cubans speculated that Raul Castro might follow a Chinese model of reform after becoming president in February. China transformed its economy three decades ago by embracing market reforms even as its Communist Party maintained strict political control.

Cuba's communist government, however, still controls well over 90 percent of the economy and shows no sign of easing its grip on political or economic matters, even as Raul Castro has expanded foreign trade 39 percent since becoming president and signed a major offshore oil exploration deal with Brazil.

On the eve of Hu's visit, the Communist Party newspaper Granma praised China's reforms as having "sparked a gigantic investment process that brought quick results." But it also criticized "the evils of such an accelerated spiral: unequal distribution of the country's income, a marked difference between city and country, and the erosion of the environment."

Hu brought a large delegation of Chinese businessmen who have busily pursued deals despite the global financial crisis, continuing a trend that has seen China's trade with Latin America jump from to $103 billion last year from $10 billion in 2000.

Kirby Jones, president of the Washington-based U.S.-Cuba Trade Association, said Hu's stop in Cuba is more about business than ideology. Jones, whose organization opposes the U.S. trade embargo against Cuba, said Cuba is eagerly pursuing deals with other countries.

Noting that Russian President Dmitry Medvedev visits next week, he said Russia and China are "perfect examples of the rest of the world jumping in to fill the void left by the U.S."