Brazil's state-run oil company signed an agreement Friday to explore for oil in deep Caribbean waters north of Cuba that officials in Havana say could contain 20 billion barrels of crude.

Under the deal, Brazil's Petroleo Brasileiro SA would spend seven years on exploration and — if the reserves are confirmed — 25 more producing oil and natural gas recovered at a site north of the world-famous beach resort of Varadero, 80 miles from Havana.

The agreement calls for an initial investment of $8 million by Petrobras. After an exploration phase of 18 to 24 months, more funds from Petrobras and its Cuban counterpart, Cuba Petroleo, could come, depending on how much oil can be exploited.

"I don't understand why it took so long to sign this agreement," said Brazilian President Luiz Inacio Lula da Silva, who presided over a signing ceremony for the deal with Cuban President Raul Castro.

The agreement gives Petrobras control of one of about 60 offshore plots in the Gulf of Mexico that Cuba has established for exploration by international companies.

Cuba suggested earlier this month that its offshore reserves potentially could produce 20 billion barrels of oil, more than double previous estimates.

Castro joked Friday that "God would not be so unfair to us as to not let us hit anything" while exploring in the Petrobras block.

Silva also said that Castro will travel to Brazil in December, a trip that would be his first official overseas visit since succeeding his older brother Fidel as Cuba's president in February.

Brazil is Cuba's second-largest Latin American trading partner, behind Venezuela.

Silva left Cuba on Friday afternoon, but told reporters at the airport that he met for two hours with Fidel Castro, 82 and ailing, who has not been seen in public since undergoing emergency intestinal surgery in July 2006.

"I'm leaving happy having seen Fidel," he said.

In comments released later by the Brazilian government, Silva said he thought the older Castro brother "is of an extraordinary mind, as lucid as he ever was."

Fidel Castro called the meeting "friendly and respectful" in an essay published online Friday night by Cuban state media.

Cuba's government did not immediately release images of the encounter.