The Spanish giant, which currently owns 46 percent of holding company Telco, has agreed to pay a starting sum of €324 million ($437 million) to up its stake to 66 percent, Telefonica said in a statement.
The remaining shares of Telco are held by Italian banks Intesa Sanpaolo and Mediobanca, which each have 11.62 percent currently, and Generali, which has 30.58 percent.
The three will gradually pare their stakes, with Generali dropping to 19.32 percent and Mediobanca and Intesa Sanpaolo to 7.34 percent each.
Telefonica will maintain its existing voting rights at 46.2 percent.
The Spanish carrier will have the right in a second phase to increase its stake in Telco to 70 percent, and the option to purchase the rest of the shares from its Italian partners from 2014.
Telefonica said it "renews its commitment to contribute to the development of Telecom Italia in its domestic market."
Telecom Italia, once the national telephone company, has been struggling with a price war in the market and with the recession.
In March, it posted a net loss of €1.627 billion for 2012, hit by an asset write-down of more than €4.4 billion in part on investments in Brazil.
Telecom Italia's shares were sharply up on the Italian stock market shortly after opening on Tuesday at 3.05 percent. Milan's MIB index of leading shares was 0.26 percent higher overall.
The news met with mixed reaction in Italy.
"The Telefonica-Telecom deal is an important turning point for our industrial future," said Marcella Panucci, director general of Italy's employers lobby Confindustria.
But Luigi Angeletti, general secretary of the Italian Labour Union (UIL), described it as "another hard blow" for the country that would have a knock-on effect on employment.
"We are losing another of the few, remaining big companies under Italian control. Inevitably, in the coming years, when it comes to deciding where to invest, decisions will be taken on the basis of interests not in Rome but Madrid," he said.