Brazil's economy unexpectedly notched up a growth rate of 0.7% in the last quarter of last year.
Finance Minister Guido Mantega told reporters: "It was a surprise even for the government."
The economy shrank in the third quarter of 2013. Many economists had expected it to shrink again and fall into recession.
Over the whole year it has grown by 2.3%, helped by strong consumer spending and investment.
But growth in agriculture was flat and industry shrank by 0.2% in the last quarter.
The figures offer some support for President Dilma Rousseff as she tries to woo investors before she stands for re-election in October.
The fact that there was a 6.3% jump in investment will help her persuade businesses that confidence is returning.
The government has also promised to cut $18.5bn (£11.1bn) in public spending to bring its deficit under control.Inflation
The Central Bank put interest rates up on Wednesday to 10.75% - the same level they were at when President Rousseff took office in 2011.
Inflation has fallen back to 5.6% after peaking at 6.7% in June.
The cutting of interest rates early on in her tenure helped growth but caused inflation and a fall in the currency. Since 2011 the Brazilian currency, the real, has fallen from 1.70 to the dollar to 2.35.
The decline in Brazil's fortunes, the fall off in public services, continuing corruption and what is seen as excessive spending on the World Cup has brought protesters out on to the streets over the last year.
The economy rode a commodity boom under former President Luiz Inacio Lula da Silva, growing on average 4%. In 2010, growth peaked at over 7%.
But it became over-dependent on the Chinese market with exports to China growing at roughly four times the rate of total exports between 2000 and 2010.
Chinese imports of soy, for example, represent over 40% of Brazil's exports.
As Chinese demand fell away, Brazilian growth stuttered, weighed down by poor infrastructure, high consumer debt and sagging business confidence.