By Fiona Ortiz

CADIZ, Spain (Reuters) - Latin America on Saturday pledged investment opportunities for recession-hit Spanish and Portuguese companies but warned its former colonial masters drastic cost cutting would only deepen their misery.

The economic plight of Iberia dominated a two-day summit of leaders from Spain, Portugal and Latin America in the southern Spanish city of Cadiz - a principle port for Spanish galleons loaded with riches in the days of empire.

In a reversal of fortune, Spain and Portugal are now banking on Latin American markets to get them on the road to recovery.

Brazilian President Dilma Rousseff was the star of the meeting because of hopes consumer demand and public building projects in her country's $2.5 trillion economy will create opportunities for Iberian companies, from energy to retail.

"We have also been hit by the crisis because of the slowdown in international markets but we are widening public and private investment in infrastructure," Rousseff told fellow leaders at the summit, which ends on Saturday.

Latin American countries are all too familiar with the type of fiscal crisis that Portugal and Spain are now going through.

Over past decades they went through boom-and-bust cycles, and devaluations and austerity programmes monitored by the International Monetary Fund.

"Don't commit the same errors we did," said Ecuadorean President Rafael Correa, warning austerity may worsen recession.

In the 1980s and 1990s, Spanish tycoons built up business empires in Latin America in what is known as the "Reconquest."

Spain's biggest companies, from banking groups Santander and BBVA to technology firm Indra and Telefonica, are increasingly dependent on Latin American revenue as domestic operations slump.

Angel Gurria, secretary general of the OECD group of wealthy nations, said Latin America has new opportunities for Spanish investment in infrastructure, technology and education.

But Latin America also holds risks for Iberian firms.

Spanish Prime Minister Mariano Rajoy said Spanish companies needed an environment of legal certainty in Latin America, referring to nationalisations in Venezuela and Argentina.

Argentine President Cristina Fernandez did not attend the summit this year, which takes place during a dispute over Argentina's nationalization in April of YPF, a unit of Spanish oil major Repsol.

Leaders of Venezuela, Paraguay, Uruguay, Guatemala, Cuba and Nicaragua were also absent. Still, attendance at this year's summit was better than last year when only half of the members showed up, raising serious questions over the event's relevance.

CONTRASTING FORTUNES

Portugal was rescued last year by Europe after it risked defaulting on public debt and now Spain - the euro zone's fourth biggest economy - is on the brink of needing aid. They are both in deep recession, while Latin America is seen growing 3.2 percent this year by the OECD and more robustly in 2013.

A quarter of the Spanish workforce is jobless. Hundreds of thousands of workers and unemployed marched on Wednesday in both countries protesting budget cuts.

Ecuadoreans, Bolivians and Colombians flocked to Spain during a building bubble that imploded in 2008, leaving the country littered with empty apartment buildings and underused airports and highways.

Now some of those immigrants have headed home and a growing number of Spaniards are seeking their fortune in Latin America.

(Additional reporting by Tomas Cobos and Angus MacSwan; Editing by Jason Webb)