(Reuters) - The German government expects Greece to stick to the terms of its EU/IMF bailout agreement after a Jan. 25 election and a possible change of government in Athens, a spokesman for Chancellor Angela Merkel said on Sunday.

However, spokesman Georg Streiter declined to comment on a report in Der Spiegel magazine that said Merkel's chancellery had shifted its view and now believed the euro zone would be able to cope with a Greek exit if necessary.

"Greece has fulfilled its obligations in the past. The German government assumes it will continue to fulfill its contractual obligations to the troika," Streiter told Reuters. "Every new government has to abide by the contractual obligations of the previous government."

The 'troika' overseeing Greece's 240 billion euro bailout comprises the European Central Bank, the European Commission and the International Monetary Fund.

As the euro zone's paymaster, Germany insists that Greece must stick to a course of austerity and not backtrack on its commitments - especially because it does not want to open the door for other strugglers to relax their reform efforts.

Greece's woes have also created a political headache for Merkel by helping to boost support for a new right-wing party, Alternative fuer Deutschland, which taps into German voters' unease over the costs of euro zone bailouts.

Der Spiegel reported on Saturday that both Merkel and Finance Minister Wolfgang Schaeuble now believe the euro zone has implemented enough reforms since the height of the crisis in 2012 to make a potential Greek exit, or "Grexit", manageable.

In addition, the euro zone now has an "effective" bailout fund, the European Stability Mechanism (ESM), another source added. Major banks would be protected by the banking union. A German finance ministry official would only say comments made by Schaeuble last week remained valid.

"If Greece takes another path, it will be difficult," Schaeuble said last week. "New elections will not change the agreements we have struck with the Greek government." Peter Bofinger, on the "wisemen" council of economic advisers to the German government, warned against "Grexit."

"There would be many high risks for the stability of the euro zone with such a step," he told Welt am Sonntag newspaper. "It would let a genie out of the bottle that would be hard to control."

Der Spiegel said Berlin considers a "Grexit" almost unavoidable if the left-wing Syriza opposition party, narrowly ahead in opinion polls, wins Greece's election. Syriza wants to cancel austerity measures and a chunk of Greek debt.

(Additional reporting by Gernot Heller; Editing by Gareth Jones)