A man sells bread rolls outside an Alpha Bank branch in Athens, Greece on June 26, 2015. Reuters/Alkis Konstantinidis

ATHENS (Reuters) - Greece's economy unexpectedly returned to growth in the second quarter despite political turmoil and the threat of a Greek euro zone exit, data showed on Thursday.

In a boost for Prime Minister Alexis Tsipras's leftist government, revised data also showed that Greece posted no growth or decline in economic output in the first quarter instead of a previously reported 0.2 percent contraction.

That meant the country did not enter into a recession at the start of the year as previously believed - a slide that was expected to have been exacerbated by Tsipras' hard line against the austerity imposed by international lenders.

Gross domestic product expanded 0.8 percent from April to June, based on seasonally adjusted flash estimates from statistics service ELSTAT. This was far above a forecast by analysts polled by Reuters of a 0.8 percent contraction quarter-on-quarter.

No official data was provided on what drove the growth as these are preliminary figures. But analysts said some sectors, such as the tourism mainstay of the economy, had shown ability to withstand the uncertainty stemming from months of deadlocked talks with foreign lenders.

"Some economic activity indicators in the second quarter, including consumption, industrial production and tourism, had shown particular resilience," said economist Nikos Magginas at National Bank. "This explains the surprising second quarter GDP reading."

He said the data helped shape a more favorable outlook for the year as a whole, rendering the prospect of an overall contraction of less than 2 percent for 2015 "realistic".

Under the baseline scenario Greek authorities have agreed with international creditors in the new bailout agreement, Greece's economy is projected to shrink by 2.1 to 2.3 percent this year.

Greece's economy emerged from a six-year recession in 2014 but shrank in the final quarter as political upheaval returned.

More recently, and not captured in Thursday's data, economic activity was sharply hit by the imposition of capital controls and a three-week shutdown of banks starting June 29.

The Greek parliament on Thursday was preparing to approve a new 85 billion euro bailout deal with the European Union that Greece needs to avoid defaulting on a debt repayment next week.