The German engineering company beat net profit forecasts during its second quarter after logging a one-off gain of 900 million euros (789 million pounds) from transferring its stake in IT services company Atos SE to its pension fund.

The result, along with the raised guidance, was taken positively by investors, pushing the company's stock 4.6 per cent higher and making it one of the best performing shares in Europe. <.STOXX>

"Most of our business, primarily our digital offerings, showed impressive performance and operationally more than offset structural challenges in fossil power generation," Siemens' Chief Financial Officer Ralf Thomas told reporters.

Siemens now expects full year earnings per share in the range of 7.70 euros to 8 euros per share, up from its previous guidance of 7.20 euros to 7.70 euros. Siemens' EPS for its 2017 business year was 7.44 euros or 7.09 euros on a comparable basis.

In the three months ended March 31, the turbines to train maker reported net profit of 2.02 billion euros, beating the forecast for 1.11 billion euros in a Reuters poll.

Siemens confirmed the rest of its guidance, including expecting a profit margin of 11 to 12 percent for its industrial business. For the second quarter, the profit margin was 11.7 percent.

Its Digital Factory unit was the star performer, increasing its profit by 40 percent during the quarter due to strong growth in China and for its industrial software.

Thomas said he expected strong growth to continue in the next quarter, although it could moderate towards the end of 2018.

Other divisions like the mobility bushiness that makes high speed trains and signalling, and process industries and drives also reported better results.

"Siemens reported a strong set of results with ongoing strength in Digital Factory offsetting the pronounced weakness in Power and Gas," said Baader Helvea analyst Guenther Hollfelder.

"However, also all the other divisions delivered better-than-expected profitability, except for Healthineers, which included IPO-related costs."

Siemens' Thomas said Digital Factory had benefited from a strong development in the short cycle and product business. He expected the trend to continue in the April to June period before moderating in the rest of the year.

The figures helped Siemens overcome a further slump in demand at its power and gas business, which makes gas and steam turbines which use fossil fuels. Here sales and orders both fell, with Siemens saying it saw no signs of recovery in the business in the medium term.

On Tuesday the company said it reached an agreement in principle with trade unions about its plans to cut jobs at the division.

The agreement meant "no one is left behind in la la land and believing that there is an easy way out," Thomas said.

(Reporting by John Revill; Editing by Keith Weir)

By John Revill