The palace is on the site of an earlier residence, which had housed the former viceroy Don Pedro de Toledo, Marquis of Villafranca. Construction on the present building was begun in the 17th century by the architect Domenico Fontana. Intended to house the King Philip III of Spain on a visit never fulfilled to this part of his kingdom, instead it initially housed the Viceroy Fernando Ruiz de Castro, earl of Lemos. By 1616, the facade had been completed, and by 1620, the interior was frescoed by Battistello Caracciolo, Giovanni Balducci and Belisario Corenzio. The decoration of the Royal Chapel of Assumption was not completed until 1644 by Antonio Picchiatti.
In 1734, with the arrival of Charles III of Spain to Naples, the palace became the royal residence of the Bourbons. On the occasion of his marriage to Maria Amalia of Saxony in 1738, Francesco De Mura and Domenico Antonio Vaccaro helped remodel the interior. It was Charles who build the other three palaces located more peripheral to the city center. Further modernization took place under Ferdinand I of the Two Sicilies. In 1768, on the occasion of his marriage to Maria Carolina of Austria, under the direction of Ferdinando Fuga, the great hall was rebuilt and the court theater added. During the second half of the 18th century, a "new wing", which in 1927 became the Vittorio Emanuele III National Library. By the 18th century, the royal residence was moved to Reggia of Caserta, as that inland town was more defensible from naval assault, as well as more distant from the often-rebellious populace of Naples.
During the Napoleonic occupation was enriched by Joachim Murat and his wife, Caroline Bonaparte, with Neoclassicdecorations and furnishings. However, a fire in 1837 damaged many rooms, and required restoration from 1838 to 1858 under the direction of Gaetano Genovese. Further additions of a Party Wing and a Belvedere were added in this period. At the corner of the palace with San Carlo Theatre a new facade was created that obscured the viceroyal palace of Pedro de Toledo.
In 1922, it was decided (by the Decree of the Minister Anile) to transfer here the contents of the National Library (until then in the palace of National Archeologic Museum). The transfer of library collections was made by 1925.
The library suffered from bombing during World War II and the subsequent military occupation of the building caused serious damage. Today, the palace and adjacent grounds house the famous Teatro San Carlo, the smaller Teatrino di Corte (recently restored), the Biblioteca Nazionale Vittorio Emanuele III, a museum, and offices, including those of the regional tourist board.