(Adds finance minister, market reaction)
By Brian Winter and Silvio Cascione
SAO PAULO/BRASILIA, May 30 (Reuters) - Brazil's economy barely grew in the first quarter as investment plunged, reflecting a broad malaise that has stirred recent labor unrest and street protests as President Dilma Rousseff seeks a second term.
Data released by the government on Friday was for the most part like a broken record of the last three years in Brazil: Shrinking factory output, falling investment and flat consumer spending, while a good performance by agriculture and heavy government spending ahead of the October election tilted the overall balance toward modest growth.
Gross domestic product grew 0.2 percent from January to March compared to the previous quarter, statistics agency IBGE said. That was a slower rate than 0.4 percent growth in the fourth quarter, a number that was revised downward.
"I couldn't find anything positive at all in the (data)," said Bruno Rovai, an economist at Barclays.
He and other economists said falling confidence among investors and consumers, plus rising inventories, likely spelled continued weak activity through 2014 and probably beyond.
Brazil's stock market fell 1.5 percent to a one-month low as pessimism spread to local companies.
After a long commodities-fueled boom last decade, Brazil's economy has fallen from grace on Wall Street and averaged just 2 percent annual growth under Rousseff's left-leaning policies.
Unemployment remains near record lows while poverty continues to fall, and many Brazilians are still happy with the gains they've made over the past decade. That helps explain why Rousseff retains a healthy lead over her two more centrist main opponents in polls ahead of the Oct. 5 vote.
Still, many voters, especially those in the middle class, are frustrated by bad infrastructure and 6 percent annual inflation eating away at their wages - and they've been increasingly inclined to vent their anger via strikes and street protests.
Possible unrest during the World Cup, which starts on June 12 in Sao Paulo, is a big concern for the government and world soccer body FIFA as the economic tensions mix with Brazilians' anger over public money being spent to host the tournament.
The World Cup will provide a needed boost to Latin America's biggest economy as more than 600,000 foreign tourists are expected to attend. The government expects the event will goose GDP by 0.5 percentage points, while private economists expect a smaller, 0.2 percentage-point increase.
Nevertheless, economists on average have said they expect GDP to grow just 1.6 percent in 2014 - and some said they would lower their forecasts once they fully analyze Friday's data.
Finance Minister Guido Mantega pointed out that GDP in the United States shrank in the first quarter, and said activity in Brazil should pick up as the global economy improves.
"We'll probably have a better second quarter," he told reporters.
Fixed investment fell for a third straight quarter, down 2.1 percent compared to the fourth quarter. Investment now accounts for 17.7 percent of Brazil's GDP - one of the lowest rates in Latin America, helping explain the lousy ports, roads and public services that have drawn many protesters' rage.
Household spending shrank 0.1 percent compared to the previous quarter, its first decline in nearly three years. Industry shrank 0.8 percent, while agriculture grew a healthy 3.6 percent.
Government spending was the other bright spot, expanding 0.7 percent. Rousseff's support among many voters is underpinned by her government's welfare and housing construction programs.
However, analysts have blamed the heavy budget spending for fueling inflationary pressure - which has in turn forced the central bank to sharply hike Brazil's benchmark interest rate to its current level of 11 percent, among the world's highest.
Many economists say that only an ambitious overhaul of Brazil's complex tax code and other structural reforms could return the economy to its glory days of 2002-10, when GDP often grew better than 5 percent a year.
Friday's GDP result was in line with market expectations in a Reuters poll. For a breakdown of Brazil's GDP data by sector, see. For economists' remarks on the GDP figures see. (Editing by Todd Benson and W Simon)