By Brad Haynes and Silvio Cascione SAO PAULO, Dec 3 (Reuters) - Brazil's economy contracted in the third quarter for the first time since early 2009 as a steep drop in investment showed flagging confidence in what was recently one of the world's most attractive emerging markets. The economy shrank 0.5 percent between July and September from the prior three months, government statistics agency IBGE said on Tuesday, missing forecasts in what has become a disappointing routine over the last three years. Gross domestic product had been expected to drop 0.2 percent, according to the median forecast of 40 economists polled by Reuters. The weak quarter reinforced a dimming economic outlook for Brazil, which has struggled to contain inflation and stay competitive in recent years, tarnishing the reputation earned with a decade of robust growth. A full-blown recession remains unlikely in Latin America's largest economy, but the slowdown increases the odds of weak growth and a possible credit rating downgrade next year, when President Dilma Rousseff is expected to seek re-election. So far the country's sturdy job market has insulated most Brazilians - as well as Rousseff's popularity - from the sluggish economy. But consumer prices have climbed faster than wages for most of the past year, sapping shoppers' appetites. Glancing at the bustling bars of Rio or the packed streets of Sao Paulo you might not notice, but beer consumption and new car sales are falling this year for the first time in a decade. Brazil's toughest month this year seems to have been July, following widespread protests against poor public services. The rebound since then has been fragile and economists are slashing forecasts for 2013 and 2014, which looks to be even weaker. "The fourth quarter started weak and growth (this year) should be closer to 2.2 or 2.3 percent than the 2.5 percent we had before," said Flavio Serrano, an economist at Espirito Santo Investment Bank. "We were not able to grow despite various economic stimulus measures ... due to a macroeconomic imbalance with little production and a lot of consumption." The stagnation in Brazil contrasts with major emerging-market peers such as Mexico, India and China, where economic growth recovered between July and September after disappointing in the first half of the year. Brazil is out of step due largely to heavy government stimulus over the past year that is starting to lose steam. The tax breaks and cheap loans unleashed by Rousseff have yielded meager results, and their withdrawal is now clouding the outlook for carmakers and furniture factories. Public spending grew 1.2 percent in the third quarter, the economy's strongest driver of new demand, but officials have warned there is no room for more stimulus as tax revenues dry up and the government misses budget targets. TOUGH YEAR AHEAD That leaves Rousseff without much fiscal firepower at the end of her first term. Next year promises to be a handful for the president, as she juggles preparations for hosting the World Cup, skepticism from business leaders and a likely withdrawal of monetary stimulus in the United States. Evaporating growth - combined with new evidence of stagnation from January to March - reinforced expectations that Brazil's central bank could soon wrap up a cycle of interest rate hikes aimed at cooling inflation. Yields on interest rate futures fell on Tuesday as traders bet increasingly on a single, smaller rate hike in January. Brazil's currency slipped to its weakest level since early September and stocks in Sao Paulo fell to a three-month low as the disappointing data turned off investors. Finance Minister Guido Mantega blamed the letdown on weak global growth and tighter consumer lending from Brazilian banks, telling reporters on Tuesday he saw the economy on a "gradual growth trend." The day before, Mantega forecast average growth of 4 percent per year over the next decade - a rate Brazil has not managed once under Rousseff - feeding criticism that the government is out of touch with investors' concerns. Brazil's economic expansion capped a booming decade with 7.5 percent growth in 2010, the year Rousseff was elected. The economy has slowed sharply since she took office, with growth of only 1 percent last year. The private sector remains wary of picking up the slack. Investment fell by 2.2 percent from the second quarter, as stifling costs and sour business sentiment discouraged capital spending. Raw material exporters such as iron miner Vale SA have also cut investment plans in the face of lower global commodity prices. The biggest drop in output last quarter came from the farm sector, which shrank 3.5 percent after a major harvest ended, giving back some of the gains of a strong second quarter. Other markets remain buoyant in the face of skeptics. Home prices in major cities have jumped over 70 percent since 2010, adding to some families' sense of struggling to keep up. The sharp depreciation of the Brazilian currency this year has also driven up the cost of imports, which were already staggeringly expensive in many cases. The Playstation 4 costs $400 in the United States but retails for 4,000 reais ($1,700) in Brazil. High taxes and steep tariffs also stand in the way of importing more productive machinery that would boost competitiveness. Brazilian factories have struggled to compete with foreign manufacturers, and more assembly lines went idle as tax breaks for many sectors began to expire in the third quarter. The industrial contribution to GDP was just 0.1 percent. But even the services sector, which faces less foreign competition, expanded only 0.1 percent in the quarter. As services play an increasingly important role in Brazil's economy, IBGE has modified its methods for calculating growth, leading to a revision of data from recent years. Brazil expanded 1.8 percent in the second quarter and remained flat in the first quarter of 2013, IBGE said on Tuesday, compared to previously reported growth rates of 1.5 and 0.6 percent respectively. The third quarter of 2011, which had previously been registered as a 0.1 percent contraction, was revised up to reflect zero growth in the period.