Brazil and Mexico said they would work towards a trade deal to tie Latin America’s top two economies more closely together, boost tiny trade flows and confront rising global competition.

The agreement follows more than a decade of attempts to deepen ties between the two countries, whose business sectors are separated by language and cultural differences - as well as long-standing distrust and regional rivalries.

The countries face tough negotiations ahead to hash out the final agreement, but Brazil’s Foreign Trade Secretary Welber Barral said officials hoped to have a deal in place by 2012.

“The objective is economic integration between the two countries,” Barral told Reuters. “We will put a lot of effort into these negotiations.”

Besides seeking to eliminate tariffs, the deal would also include investment, government procurement and intellectual property rights, the governments said in a joint statement.

Bilateral trade between Mexico and Brazil totaled $5.9 billion in 2009—only a little more than 1 percent of Mexico’s total trade, which is primarily with the United States.

Brazil’s commerce is focused on China, its South American neighbors and Europe. Mexico and Brazil already have a limited trade deal in place.

Brazilian President Luiz Inacio Lula da Silva called the size of the countries’ trade balance “a disgrace” back in February when he and Mexican President Felipe Calderon launched the idea of a trade deal.

Mexico is keen to diversify its trade after it suffered one of the worst recessions due to its dependence on the U.S. market, which buys about 80 percent of local exports.

Lula worked to improve relations with Mexico during his term, and analysts said the timing of the talks signaled Brazil’s desire to keep up relations with Mexico as president-elect Dilma Rousseff prepares to take over in 2011.

Brazil’s Barral said Latin America needed to band together to face off increasing competition from cheaper Asian goods.

“Either Brazil and Mexico ... manage to implement an industrial integration process that keeps production of scale in the region, or our industries will migrate to other countries,” Barral said.

Mexico has fallen behind Brazil in part because a bitterly divided Congress has failed to pass substantive reforms to outdated tax, energy and labor laws, and an upcoming presidential race could scuttle chances for a far-reaching deal, analysts said.

Overtures to eliminate tariffs have raised concerns among Mexican farmers, who feel they may not stand up to Brazil’s agricultural might, as well as industrial groups that are uncertain of the benefits a deal could bring.

Any deal hashed out by the two administrations would still have to be ratified by their respective national legislatures.

Political parties in Mexico are already jockeying ahead of presidential elections in 2012, and analysts said Calderon may not be able to muster the political support to approve a comprehensive trade deal without solid backing from business.

“It doesn’t seem to me that the private sector understands what are the benefits to them,” said Luz Maria de la Mora, a Mexico-based trade expert and former government negotiator.

“Where do you get the political capital to come up with an agreement like this one, which has such a low level of consensus on the (private) sector side?” (Reuters)