After a tough first quarter, Brazilian farmers are injecting life back into a stagnant economy at a time when manufacturers and consumers are retrenching.

Agriculture has long been known as the green anchor of Brazil's economy, now the world's sixth-largest. One of the world's breadbaskets, Brazil is a major producer of soybeans, corn, sugar, coffee, oranges and beef, and has invested heavily in the past decade to keep up with surging global demand.

But the agricultural sector kicked off 2012 on the wrong foot, adding to the woes of an economy that has been struggling for the past year. Agricultural output contracted 8.5 percent in the first quarter, hit by a drought in the grains belt, a poor sugar cane crop and tight credit markets.

The slump in Brazil's farm belt, however, was short-lived. The agricultural sector, which accounts for nearly 30 percent of Brazil's gross domestic product, is expected to be a bright spot when GDP data for the second quarter is released on Friday.

And the trend is expected to continue well into next year, as Brazilian farmers reap the benefits of record prices for soybeans, corn and beef, helping to fill a void in global supply after a crushing drought in the United States.

"The outlook for grains is super positive and soy is going to lead it," said Jose Hausknecht, a director at MB Agro, a local consulting firm that tracks the agricultural sector. "It will start to show up in the second quarter."

That's good news for multinational commodities traders like Bunge Ltd (BG.N), Cargill CARG.UL, Louis Dreyfus LOUDR.UL, ADM (ADM.N) and Noble Group (NOBG.SI), which all rely on business in Brazil for their revenue. The same holds for farm machinery makers John Deere (DE.N) and AGCO (AGCO.N).

To be sure, Brazil's economy faces many hurdles that may be too big for the farm sector to overcome alone. Big industry, including automotive and manufacturing, is a key part of the economy and is not expected to recover soon. And consumer confidence has started to fall as have federal tax revenues.

Even in commodities, some sectors are dragging. Big miners such as Vale (VALE5.SA) have been battered by weaker prices for iron ore, copper, nickel and aluminum. And poultry and pork producers are cutting production due to high feed prices.

SOYBEANS TO LEAD

Elsewhere in the farm sector, the prospects shine.

Despite last year's drought, Brazil still brought in a record crop of 166 million tonnes of grain that started peaking in March, which will support economic growth. This coincided with a weakening of the Brazilian real, which makes dollar-linked exports worth more in local currency terms.

"The second quarter numbers will surprise everyone," Agriculture Minister Jorge Mendes Ribeiro Filho said after meeting with President Dilma Rousseff last week.

In reais, soybean futures prices jumped 28 percent from March through June. Soy exports, Brazil's biggest farm export earner, are up 11 percent in the second quarter, despite a 12 percent drop in last year's harvest.

The trend for increased exports looks set to continue in the wake of the drought over the U.S. soy and corn crops.

China's commodity imports continue to defy expectations of a major slowdown. The latest tranche of trade data paints a strong picture, Barclay's Research said. China, Brazil's main trade partner, imported 318 percent more corn and 10 percent more soy in the past quarter.

"China's food imports going forward are likely to result in a soft commodities super cycle," said Bo Zhaung, a China-based economist for research analysts Trusted Sources, who recently visited Brazil.

Brazilian farmers also planted a record corn crop this year, harvesting 72 million tonnes, above the 66-million-tonne soy crop for the first time in a decade.

Corn exports are up 111 percent from last year from April through June, the trade ministry said. Corn futures prices in local currency terms were little changed in the quarter but are up 38 percent since June.

Going forward, the scenario looks exceptional for grains, as local soybean producers gear up for one of the most expressive leaps in planting in decades, in response to record prices caused by the U.S. drought.

Brazil's crushing industry association Abiove expects the soy industry to export a record 37.5 million tonnes of soy from the crop that will start planting in September, up from 30.5 million in exports from this crop. And revenues from exports are expected to rocket to $30 billion from $22.6 billion.

May-June rains improved the outlook for next year's sugar cane crush, which should near the record 560 million tonne center-south crop of 2010/11.

And local beef producers, who are less at the mercy of global grains prices because Brazil's 200-million-head herd is largely grass-fed, are looking at a "Christmas Year for beef" sales, said Luis Ricardo Luz, operations director at one of Brazil's big meat packers Minerva (BEEF3.SA).

INFRASTRUCTURE HURDLES

Record crops will mean stress on Brazil's dilapidated infrastructure, however. Ports, roads and railways have been the Achilles heel of the country on which the world is increasingly depending for its raw commodities.

Roberto Messenberg, an economist at Ipea, a government think tank, said strong food prices would fuel a revival in Brazilian agriculture but warned that structural change and infrastructure investments were still essential for sustainable growth.

"Recovery in agroindustry, due to climate shocks, is temporary and doesn't mean a medium-term investment trend," Messenberg said.

President Rousseff is trying to tackle Brazil's infrastructure deficiencies with a $66 billion investment plan that will grant concessions to private companies to overhaul and expand the country's roads and railways. A similar plan for airports and seaports is also in the pipeline.

But government officials acknowledge that the projects will take years to be completed.