It was Felipe V, the first Bourbon king of Spain, who created what is now the country's National Library, although when he opened it in 1712 it was known as the Royal Library. He did so with two reasons in mind: to encourage ordinary people to study, and to house the libraries of noblemen who fled Spain after fighting on behalf of Charles of Austria in the War of Succession. It was decided to create the Royal Library in the passageway between the Real Alcázar and La Encarnación monastery.
On 26 July 1716, Felipe issued a Royal Decree requiring authors, printers and publishers - in fact anyone who financed the printing of books and papers - to provide the Royal Library with a bound copy of everything they printed.
A later resolution in 1750 gave the Royal Library the right to select and purchase any books from libraries which were to be auctioned, within an eight-day period. This enabled it to expand its collection.
In 1761 a Royal publishing house was founded, directed by the Chief Librarian, which linked the library to the most outstanding printers, book-binders and printmakers of the era. In 1793, the publishing side moved to new premises.
The library also moved several times, to the Trinitarios Calzados monastery, then the Palace of the Council of the Admiralty and finally a mansion in Calle Arrieta.
The Royal Library became the National Library, and the responsibility of the government, in 1836. Thirty years later, the first stone was laid of the premises which still houses the National Library today, in the Paseo de Recoletos, but the building was not completed until 1892 and in the meantime an additional book depository had to be built in the garden of the building occupied by the Library on Calle Arrieta.
The National Library building was classified as a national Monument of Historic and Artistic Value in 1983, and was granted the status of an Autonomous Body in 1991.
It is now one of the largest in the world, and its catalogue contains bibliographic references to all books published from 1831 onwards as well as antique books, pamphlets and printed sheets published up until 1830, manuscripts, journals and newspapers, engravings, drawings and photographs, maps and plans, musical scores and sound and video recordings.