* Q3 operating profit 4.9 bln SEK vs fcast 4.8 bln
* Orders rise slightly in quarter
* Sees somewhat weaker demand in near term
* Op margin 22.3 percent vs f'cast 22.0 percent
* Shares rise 3 pct (Adds analyst comment, detail, updates shares)
By Niklas Pollard and Johannes Hellstrom
STOCKHOLM, Oct 24 (Reuters) - Compressor and mining machinery maker Atlas Copco AB posted forecast-beating quarterly earnings and squeezed out a slight rise in orders in tough markets.
Though the Swedish company forecast lower demand for its products in the near term, its shares were boosted by the positive earnings surprise, creating a rare bright spot in a hard pressed engineering sector.
"One shouldn't think that the current state of demand doesn't apply to Atlas Copco ... Rather this is a question of coping with it," said Handelsbanken analyst Peder Frolen.
"And the fact that the company is able to push up margins (on the previous quarter) ... bodes well for the future," Frolen said on Wednesday.
Atlas Copco and domestic rival Sandvik AB, both major producers of mining gear such as drill rigs, crushers and loaders, have seen the mining boom falter in recent months, reflecting the slowing global economy.
But quarterly order bookings at Atlas totalled 21.4 billion crowns ($3.2 billion) compared with a year-ago 21.2 billion, as weaker orders from the mining, construction and manufacturing industries were offset by strength in other businesses.
"The order volumes for compressors remained healthy," the company said, pointing also to good activity for its services and parts, a growing business that in recent years has served as a resilient buffer in periods of slumping equipment sales.
A flexible production system, allowing for swift and less costly adjustments of output through a high level of outsourcing of components, has also shielded earnings at the group, not least during the dramatic downturn during the 2008/2009 crisis.
Operating profit at Atlas rose to 4.92 billion crowns ($739.2 million) from a year-ago 4.80 billion and a mean forecast for 4.79 billion in a Reuters poll of analysts.
The company also posted its strongest operating margin of the year at 22.3 percent, to come in just above the 22.0 percent seen by analysts.
Caterpillar Inc, the world's biggest maker of excavators and tractors, this week slashed its 2012 forecast for a second time this year and said the economy was weakening faster than expected.
Truck maker Volvo AB painted a gloomy picture for its sizeable construction equipment arm and cut some market forecasts for the unit.
Shares in Atlas Copco rose 2.7 percent to 155.10 crowns by 1230 GMT, while Sandvik, due to report on Thursday, was up 0.7 percent. ($1 = 6.6562 Swedish crowns) (Additional reporting by Helena Soderpalm; Editing by Patrick Lannin and David Holmes)