* SPD to get foreign, finance, labour ministries -source
* CDU to get economy and defence ministries -Bild
* Bavarian CSU to get interior ministry (Adds details on labour policy, healthcare, ministries, economist, newspaper report about Schulz planning to step down as SPD leader)
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 allies 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, a post held until recently by conservative Wolfgang Schaeuble, widely despised in struggling euro zone states during his eight-year tenure for his rigid focus on fiscal discipline.
SPD leader Martin Schulz said earlier this week that his party had ensured 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 and secure Merkel's fourth term in office.
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.
While the talks have dragged on, Europe's biggest economy has moved into overdrive, suggesting that there may be increased scope for government spending and investment.
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 should allow German to resume its leading role in international affairs and, at least for now, put an end to questions about how long Merkel will stay in her job.
The full set of 91 negotiators were to meet at 2 p.m. (1300 GMT) to give the deal the green light, negotiators said.
Investors and partner countries had been concerned by Merkel's failure to assemble a government in more than four months at a time when Europe faces 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.
Bild newspaper reported that Schulz would become foreign minister, despite having previously vowed not to take a cabinet position under Merkel. Newspaper Sueddeutsche Zeitung said Schulz would quit as SPD leader and parliamentary floor leader Andrea Nahles was ready to take over.
Hamburg Mayor Olaf Scholz is slated to take over as finance minister, according to sources familiar with the negotiations.
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 news agency DPA said the conservative acting finance minister, Peter Altmaier, would become economy minister.
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 repeatedly extended that deadline as they grappled with reforms to health insurance and employment policy demanded by the SPD.
After a marathon all-night session, the parties ultimately agreed to cap at 18 months fixed-term contracts imposed by employers without justification, down from 24 months under current rules, a source involved in coalition negotiations said. The source said they also agreed to ban the endless renewal of such contracts.
The SPD had wanted to give employees more security by totally banning employers from imposing short-term contracts without justification. But conservatives balked, arguing that firms needed hiring and firing flexibility to be competitive.
On healthcare, the parties agreed to set up a commission to work on a joint fee structure for private and public patients, a negotiating source said, adding that whether it was ultimately introduced would depend on its feasibility.
Doctors tend to get more money for treating private patients under the current system, so often favour them over public patients.
Florian Hense, an economist at Berenberg, said the labour and healthcare reforms, along with more generous pension entitlements, could be expensive. "Germany may pay a price for them with slightly reduced trend growth and a less solidly financed budget after the next recession."
That prospect may be a way off, however. The DIHK Chambers of Industry and Commerce raised its 2018 growth forecast for the German economy to a robust 2.7 percent.
Record-high employment, increased job security, rising real wages and low borrowing costs have helped to spur a a consumer-led upswing, strengthened recently by a rebound in exports and company investments.
"Companies have never been more upbeat," DIHK said in its latest business survey, adding that German firms are boosting investment plans at an unprecedented pace.
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, Thorsten Severin and Andrea Shalal; Writing by Michelle Martin; Editing by Kevin Liffey)