Telefonica SA said Thursday it agreed to buy Telecom Italia SpA's German broadband unit Hansenet in a move to improve its foothold in the competitive German telecommunications market.

In a filing to the Spanish market regulator, Telefonica said the deal values Hansenet at EUR900 million and that it would be done