Spain's Telefonica will buy broadband operator HanseNet from Telecom Italia for 900 million euros ($1.34 billion), Telefonica said on Thursday, strengthening its competitive position in Germany.

Analysts and media reports had indicated that the unit could fetch 900 million to 1 billion euros after Telefonica said in October it was negotiating a price with its Italian ally.

Telefonica, Europe's largest telecoms company, has a fixed line network in Germany but not very many customers, while HanseNet has a market share of about 10 percent, making it the fourth largest DSL service provider. The buy should therefore transform Telefonica's local unit O2 Germany into a relevant player.

The deal, which is subject to regulatory approval and a final agreement between the two parties, is expected to be closed in the first quarter of 2010.

By 1447 GMT, Telefonica shares were up 1.5 percent at a session high of 19.16 euros.

The company said combined sales for its Telefonica O2 brand in Germany would reach 5 billion euros after the Hansenet buy.

It should also slow the number of customers leaving its mobile service for alternative packages that include a bundle of, for example, mobile, fixed and braodband services, according to analysts.

(Reporting by Tracy Rucinski, editing by Will Waterman)

($1=.6734 Euro)