* SPD to get foreign, finance, labour ministries -source
* CDU to get economy and defence ministries -Bild
* Bavarian CSU to get interior ministry (Updates with new details of coalition deal)
BERLIN, Feb 7 (Reuters) - German Chancellor Angela Merkel's conservatives and the Social Democrats (SPD) on Wednesday agreed to a coalition deal, taking Europe's economic powerhouse closer to a new government after months of uncertainty that unnerved partner countries and investors.
In a move likely to mean a shift in Germany's euro zone policy, media reported the SPD would take the finance ministry that was until recently presided over by conservative Wolfgang Schaeuble, widely despised in struggling euro zone states during his eight-year tenure for his focus on austerity.
SPD leader Martin Schulz said earlier this week that his party had ensured that an agreement with the conservatives would put an end to "forced austerity" and set up an investment budget for the euro zone.
Handing over the crucial finance ministry suggests the conservatives had to make big concessions to get the SPD to agree to renew the 'grand coalition' that has governed Germany since 2013.
Bruised by its worst election result in the post-war era, the SPD had planned to revamp itself in opposition and only agreed to the coalition talks reluctantly. Its 464,000 members still have the chance to veto the deal in a postal ballot.
In a message posted alongside a photo of Schulz and other SPD negotiators smiling, the SPD negotiators wrote: "Tired but happy. There is a treaty! Finally. Now the final details are being worked into the text."
The agreement will lift much of the uncertainty that has weakened Germany's role in international affairs and raised questions about how long Merkel will stay in her job.
News of a deal will bring some relief to investors and partner countries, who had been concerned by Merkel's failure to cobble together a government in more than four months at a time when Europe is facing multiple challenges - including the need for euro zone reform and Britain's looming departure from the EU.
A negotiating source said the SPD would have the finance and labour ministries while media reported the party would also secure the justice, family and environment ministries.
Merkel's Christian Democrats (CDU) will get the economy and defence ministries while their Bavarian allies, the Christian Social Union (CSU), will provide the interior minister in the form of Horst Seehofer, who talks tough on migration, media reported.
The conservative bloc and the SPD began talks about renewing their alliance after Merkel's coalition talks with two smaller parties collapsed last November. Both camps have seen their support wane.
An Insa poll on Monday had support for the SPD dropping to 17 percent, below its election result of 20.5 percent. The conservatives slipped to 30.5 percent, suggesting there would be no majority for a grand coalition if an election were held now.
The two blocs had aimed to strike a deal on Sunday, but extended that deadline as they grappled with health insurance reform and employment policy demanded by the SPD, which promised members it would negotiate until the conservatives squealed.
CDU leaders were due to meet at 3 p.m. (1400 GMT) to give the coalition treaty the green light.
Alice Weidel, leader of the far-right Alternative for Germany (AfD), the biggest opposition party, tweeted: "Things could not get worse for Germany," calling the coalition deal "insane" as it did not contain an upper limit for migration. (Additional reporting by Holger Hansen, Michelle Martin and Thorsten Severin and Andrea Shalal; Writing by Paul Carrel and Michelle Martin; Editing by Kevin Liffey)