What a great question — yet not an easy one to answer. The simplest response would be to say that the Holy Spirit decided. But that doesn’t explain the wonderful way in which the Spirit acted.
The canon of the Bible is the list of books officially recognized as inspired Scripture that have a regulating value for Christian faith and morals. This list did not drop out of the sky. Rather, the Holy Spirit worked through the church over the course of centuries so that the magisterium could authentically discern the rightful content of the Bible.
This process of discernment began when the oral tradition took written form and those texts were used for public prayer and worship. This process took nearly 1,000 years for what Christians now call the Old Testament.
The canon of Scripture was defined for Jews by the end of the first century, but it was not yet defined for Christians. This discrepancy gave rise to multiple biblical controversies over the centuries, culminating in a definitive declaration during the fourth session of the Council of Trent (1547).
Catholics would recognize all 46 books contained in the Greek translation known as the Septuagint, while Protestants generally recognized only the 39 books contained in the Hebrew canon of Scripture. This seven-book difference between Catholic and Protestant Bibles continues to this day.
The New Testament was easier to define and emerged over the first few centuries of Christianity. Initial lists of accepted inspired writings, like the Muratorian Canon, appeared as early as the second century, along with criteria for discernment and acceptance. These criteria included correct expression of Christian faith (orthodoxy), use in public worship and Christian formation, and apostolic origin.
The early bishops of the church frequently compared and shared their local writings with other Catholic communities. Through this process of sharing, praying and studying these early writings, the bishops were guided by the Holy Spirit in their discernment of authentic New Testament Scripture at the Council of Nicaea (325), and finally established the canon of Christian writings at a Roman synod in 374 convened by Pope Damasus I in conjunction with the translation of the Bible into the vernacular (Latin) by St. Jerome.
Although the Protestant reformer Martin Luther sought to diminish some books of the New Testament canon (especially Hebrews, James, Jude and Revelation), those writings were eventually retained, and the canon of Christian writings remained intact for both Catholics and Protestants. The 27 books of the New Testament are contained in every Christian version of the Bible.
The Holy Spirit
The Holy Spirit works through human agency, so it is important for us to be open to the Spirit’s guidance and inspiration so we can properly interpret the events of our world according to the mind of Christ and act with fidelity as the body of Christ.
The same Holy Spirit who guided the sacred writers of the past speaks to us through those writings when we are gathered in prayer at Mass so we can more readily recognize the beautiful presence and action of God in our lives now and respond with faith, hope and love.