Finnish mobile company Nokia (NYSE:NOK) fell to a loss in the second quarter as it faces tough competition from Apple and Google's Android-powered smartphones, and recorded a restructuring charge.

However, excluding one-time items, it managed to beat analysts' expectations, sending its shares up 5 percent in the pre-market hours.

For the second quarter, Nokia reported a loss attributable to equity holders of parent of 368 million euros ($521.4 million), or 10 cents a share, compared with a profit of 227 million euros, or 6 cents a share, in the same quarter last year.

Excluding special items, Nokia reported earnings of 6 cents a share, lower than the 11 cents a share reported last year. Nokia's results were benefited from royalty revenues of 430 million euros, which included payments from Apple.

Quarterly sales fell 7 percent to 9.28 billion euros ($13.16 billion) from 10 billion euros last year. Devices and services unit segment's sales declined 20 percent to 5.46 billion euros, with smartphone sales falling 32 percent to 2.37 billion euros.

Wall Street expected the Finnish company to report earnings of 3 cents a share on revenue of $13.04 billion.

The company shipped 88.5 million phones, down 20 percent from 111 million shipped last year. Smartphone volumes slipped 34 percent to 16.77 million units. On the other hand, Apple sold 20.3 million iPhones in the quarter.

The company posted lower sales in all geographies barring Middle-East and Africa, and Latin America. Sales in North America slipped 5 percent to 467 million euros, Europe fell 15 percent to 2.87 billion euros, China decreased 24 percent to 1.32 billion euros and Asia-Pacific fell 4 percent to 2.06 billion euros.

On the positive side, sales from Nokia Siemens network rose 20 percent to 3.64 billion euros.

Nokia, which was once the mobile phone giant, has struggled to gain ground in the market over the last few years, largely due to intense competitive pressure from Apple (NASDAQ:AAPL), Research in Motion (NASDAQ:RIMM), Motorola Mobility (NYSE:MMI) and Samsung in the smartphone segment.

Despite struggling in U.S., Nokia used to dominate in emerging markets, where also it now faces competition from cheaper Android devices and Chinese manufacturers.

As a result, Nokia has lost overall mobile phone market share, suffered from declining profit margins and scrapped its smartphone operating system for future models creating significant uncertainty for the firm's outlook. Nokia is expected to ship phones having Microsoft's Windows Phone 7 operating system in the fourth quarter of this year.

The challenges we are facing during our strategic transformation manifested in a greater than expected way in Q2 2011. However, even within the quarter, I believe our actions to mitigate the impact of these challenges have started to have a positive impact on the underlying health of our business, CEO Stephen Elop said in a statement.

Looking ahead, Nokia expects to exceed its previous cost-cutting target of 1 billion euros for the full year 2013. It also expects its net cash and other liquid assets at the end of 2011 to be above the second quarter balance of 3.9 billion euros.

Meanwhile, Nokia Siemens Networks net sales are expected to be between 3.2 billion euros and EUR 3.5 billion euros in the third quarter 2011. The division's net sales have been projected to grow faster than the market in 2011.

ADRs of Nokia were up 5 percent in the pre-market hours to trade at $6.08. The stock closed Wednesday's regular trading session at $5.79 on the NYSE.