It cost 30 million euros ($A49 million), one of the largest sums the state has ever paid for a single artwork.
Painted in 1598, the work depicts Monsignor Maffeo Barberini, an influential cleric who later became Pope Urban VIII, one of the great patrons of the arts of his time.
The work had been held in a private Florence collection and was attributed to Caravaggio in 1963.
It was shown in public for the first time in 2024 at Rome's Palazzo Barberini and will now enter that museum's permanent collection.
"After more than a year of negotiations, we are announcing today the acquisition ... of an extraordinary masterpiece by Caravaggio," Culture Minister Alessandro Giuli said in a statement.
He described the purchase as part of a broader effort to strengthen Italy's public cultural heritage and prevent major works from disappearing into private collections.
The acquisition comes a month after the culture ministry bought Antonello da Messina's Ecce Homo for $US14.9 million ($A20.9 million), securing the rare work by the 15th-century Renaissance master just as it was due to be auctioned in New York.
Caravaggio, whose real name was Michelangelo Merisi, was a master of the chiaroscuro technique of lighting to make his subjects seem to come alive.
He died in 1610 in his late 30s after a turbulent life.
The painting of the future Pope Urban VIII is one of only a handful of surviving Caravaggio portraits, with others having been lost or destroyed.
Only about 60 paintings worldwide are attributed to Caravaggio, many depicting religious narratives.
The Barberini portrait shows the bearded cleric seated and seemingly issuing instructions with a subtle gesture of his right hand.
The culture ministry said it would look to buy more artworks in the coming months "with the aim of making available to scholars and enthusiasts certain masterpieces of art history that would otherwise be destined for the private market".