STOCKHOLM, June 28 (Reuters) - Nokia's bid to buy U.S. optical networking gear maker Infinera in a $2.3 billion deal puts the Finnish company on track to gain from the billions of dollars in investment pouring into data centres to cater to the rise of artificial intelligence.

The deal would help Nokia to leapfrog Ciena and become the second largest vendor in the optical networking market with a 20% share, behind Huawei, which is benefiting from the minimal presence of Western companies in China.

Telecom gear makers, struggling with lower sales of 5G equipment, have been looking for ways to diversify their markets and get into growing areas such as AI.

Nokia's move will allow the company to sell more equipment to big tech companies such as Amazon, Alphabet and Microsoft as they invest billions of dollars in building new data centres to service the artificial intelligence boom.

"This is pretty optimal timing for a deal of this nature when you are timing it just before the market is expected to start to recover," Nokia CEO Pekka Lundmark said in an interview with Reuters.

"AI is driving significant investments in data centres ... one of the key attractions of this acquisition is that it significantly increases our exposure to data centres," he said.

Data centres use optical transport networks - cables made of glass that transmit digital signals - to allow electronic devices to talk to each other.

Infinera is especially strong in intra data centre communications, which refers to server-to-server communications inside data centers. This will be one of the fastest growing segments in the overall communications technology market, Lundmark said.

Nokia shares rose 4% in morning trade, signaling that the shareholders are bullish about the deal. The share price of buyers would typically ease due to dilution in a cash-and-stock deal.

Nokia, which will pay 70% of the purchase price in cash and the rest in stock, expects to save 200 million euros ($213.88 million) in costs following the deal's closure next year.

While the purchase multiple may be somewhat steep as Infinera had a lumpy growth trajectory, if Nokia could extract the 200 million euros in synergies, then the purchase price would be justified, said Mads Rosendal, analyst at Danske Bank Credit Research.

Infinera gets about 60% of its business from the United States, while Nokia had a bigger share in Europe and Asia, making it a complementary transaction, said Lundmark.

"The two businesses together have combined cost of sales of over 2 billion euros and operating expenses of over a billion euros ... so against that target, 200 million (euros) is not a particular stretch," Lundmark said, adding that it was too early to comment on potential layoffs. ($1 = 0.9351 euros) (Reporting by Supantha Mukherjee in Stockholm; Editing by Ros Russell)