The 73-year-old Sicilian, who was backed by Prime Minister Matteo Renzi's centre-left Democratic Party (PD), succeeds the hugely popular Giorgio Napolitano, 89, who is stepping due to old age.
Matteralla's election was seen as a master stroke by Renzi. The premier's backing for the austere, left-leaning Matteralla, who ha crossed swords with former prime minister Silvio Berlusconi, helped both unify the ruling party and send a message to Berlusconi that the government no longer depended on his support to pass reforms.
“Good work, President Mattarella! Long live Italy!”, a jubilant Renzi tweeted.
Pope Francis and US President Barack Obama were among the other leaders to send congratulations.
Mattarella won 665 votes in the fourth round of voting by a 1,009-member electoral college, composed of members of the two houses of parliament — the Senate and the Chamber of Deputies — and 58 representatives of the regions. Ferdinando Imposimato, the candidate of the anti-establishment Five Star Movement of Beppe Grillo, won 127 votes. The threshold for victory at the fourth round was a simple majority, down from the two-thirds majority needed for a win in the three opening stages.