Nokia Corp. swung to a net profit in its most recent quarter, saying it was forging ahead with the proposed €15.6 billion ($17.1 billion) acquisition of rival Alcatel-Lucent SA in a bid to strengthen its hand in the fiercely competitive market for telecoms equipment.

The Finnish maker of high-speed wireless networks on Thursday recorded a net profit of €351 million in the second quarter, abetted by a stronger dollar and solid software sales. Stripping out gains from the disposal of its handset business, Nokia had a net loss of €28 million in the same period a year earlier.

Second quarter revenue from its mainstay networks unit rose 6% to €2.73 billion but fell 4% excluding currency fluctuations, Nokia said.

Alcatel-Lucent, which reported its first quarter of positive free cash flow since the company was created in 2006, narrowed its losses in the three months to June 30 as it reaped the benefits of stiff cost-cutting and a shift to higher margin businesses.

Nokia and Alcatel-Lucent shares shot up at the opening of the Helsinki and Paris bourses on Thursday, and were up 7.7% and 5.5%, respectively, in late morning trading on the back of the quarterly results, analysts said.

Once the world's leading supplier of mobile handsets, Nokia is in the process of reshaping itself into a global provider of equipment and software to telecoms carriers.

The all-share purchase of Alcatel-Lucent, which recently cleared antitrust hurdles in Europe and the U.S. but has yet to be approved by Nokia shareholders, could catapult the company into the same revenue league as market leaders, Ericsson AB of Sweden and Huawei Technologies Co. of China.

It could also help the enlarged company battle in what Nokia and Alcatel-Lucent executives describe as a crushing business environment, giving them more pricing power to negotiate with big customers.

"It is as competitive out there as it has ever been," said Jean Raby, Alcatel-Lucent's chief financial officer. "But the group will have such a scale and scope that we will be able lead the next phase," he added.

Thursday's results by both Nokia and Alcatel-Lucent underscore the challenge facing telecoms equipment suppliers: eking out growing profit in an environment where big telecommunications companies in their main markets are spending less.

The prognosis in some of the biggest markets for telecommunications equipment aren't rosy, as spending on the rollout of wireless 4G winds down. In North America—where Verizon Communications Inc. and AT&T Inc. contribute 30% of Alcatel-Lucent's overall sales—revenue was down 18% year on year in constant currency for Alcatel-Lucent. In Asia, revenue was down 12%, in part because of the timing of wireless projects in China, the company said.

In response, Alcatel-Lucent has continued to slash costs and jobs under its Shift Plan, and has shifted resources to its higher-margin Internet routing businesses. Revenue there was up 3% in constant currency in the second quarter to €659 million.

That helped the company beat expectations on operating income, which rose 29% to €175 million. Gross margins improved 34.8%, compared with 32.6%

"Next generation technologies now represent more than three quarters of our revenue," Mr. Raby said. "This improvement is really about the operational profitability of the group."

Nokia said it hoped to complete the Alcatel-Lucent acquisition in the first half of next year. Alcatel-Lucent said that Chief Executive Michel Combes plans to leave the firm on Sept. 1, ahead of the planned takeover.

The Finnish company said a review of its digital mapping business, known as Here, was at "an advanced stage," and declined to comment on reports that Nokia has agreed to sell the unit to a group of Germany auto makers for slightly over €2.5 billion.

Write to Sam Schechner at sam.schechner@wsj.com and Jens Hansegard at jens.hansegard@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires