Birth and studies
Lambertini was born into a noble family of Bologna to Marcello Lambertini and Lucrezia Bulgarini, the third of five children. At the time of his birth, Bologna was the second largest city in the Papal States. At the age of thirteen, he began attending the Collegium Clementianum in Rome, where he studied rhetoric, Latin, philosophy, and theology. During his studies as a young man, he often studied the works of St. Thomas Aquinas, who was his favourite author and saint. While he enjoyed studying at Collegium Clementianum, the bent of his mind was well towards ecclesiastical and civil law, and actively enforcing it. Soon after, in 1694 at the age of nineteen, he received the degree of Doctor of Sacred Theology and Doctor Utriusque Juris (both ecclesiastical and civil law).
On the death of Innocent XII, he was made a consistorial advocate by Clement XI, with whom he worked closely. Shortly after, he was created a Consultor of the Supreme Sacred Congregation of the Roman and Universal Inquisition, then in 1708, Promoter of the Faith; in 1712 a theologian of canon law and assessor of the Sacred Congregation of Rites; in 1713 he was named monsignor; in 1718 secretary of the Sacred Congregation of the Council; and in 1725, titular bishop of Theodosia.
Lambertini was consecrated a bishop in Rome, in the Pauline Chapel of the Vatican Palace, on 16 July 1724, by Pope Benedict XIII. The co-consecrators were Giovanni Francesco Nicolai, titular Archbishop of Myra (Vicar of the Vatican Basilica), and Nicola Maria Lercari, titular Archbishop of Nazianzus (Papal Maestro di Camera).
He was made Cardinal in pectore in 1726 and Bishop of Ancona in 1727. He was published as Cardinal on 30 April 1728, and was subsequently made the Cardinal-Priest of Santa Croce in Gerusalemme on 10 May 1728. He participated in the 1730 conclave, and in 1731 became Archbishop of Bologna.