Antonio Somma based the libretto of Un ballo in maschera on Eugène Scribe's libretto, Gustave III, ou Le bal masque, written for Daniel-François-Esprit Auber and first performed in 1833. Although Somma was a skillful poet, Verdi found it necessary to instruct him in the art of developing a libretto. Verdi and Somma first worked together on Re Lear, but this was never completed. Facing a deadline for the Teatro San Carlo in Naples, Verdi and Somma forged ahead with Un ballo in maschera (at first entitled Una Vendetta in Domino), but the Neapolitan censors demanded so many significant changes Verdi withdrew the piece and offered it to the Teatro Apollo in Rome. The Roman censors required, among other things, a change of locale, thus the action of Un ballo in maschera takes place in and around Boston, Massachusetts, near the end of the seventeenth century. (In protest to this and other changes, Somma asked that his name be omitted from the program.) It was first performed on February 17, 1859, achieving a great success and within three years playing throughout Europe and in New York. Some modern settings restore Scribe's eighteenth century Swedish setting and characters, a practice Verdi never approved. Scribe's libretto, based in part on historical fact, concerns the 1792 assassination of King Gustave III of Sweden at a masked ball. Although the real murder was most likely politically motivated, Scribe adds the element of jealousy by creating an affair between the King and the assassin's wife. Much of the opera is a straightforward translation of Scribe's libretto.
Verdi's Un ballo in maschera is often discussed as an example of his "middle period" and shows the infusing of French elements into Verdi's intense approach to Italian serious opera. Contrapuntal writing permeates the orchestral prelude, which introduces us to the "sympathy" motive we hear in the opening chorus, the conspirator's motive and the melody of Riccardo's first aria, "La revidrà nell'estasi." Throughout the opera the orchestra continues to speak conspicuously, especially in the English horn obbligato in Amelia's first aria and similar passages for the cello in her second. An excellent example of the orchestral colors Verdi achieves is the fortune teller Ulrica's first scene (the second scene of Act One), featuring dark, low woodwinds playing unsettling tritones. Verdi applies old forms to Ulrica's ensuing aria, "Re dell'abisso," which begins in the minor and moves to the major for the cabaletta portion. Later in the scene, Verdi illustrates Ulrica's mysterious powers through her highly chromatic, "Della città all'occaso." Un ballo in maschera contains only one duet, one of Verdi's greatest. Occurring in Act Two between Riccardo and Amelia, the duet is a succession of declamatory outbursts that create a dialogue, held together by melodic material in the orchestra. A second section further contrasts the characters' melodic personalities and the duet closes with a lively cabaletta, "Oh qual soave brivido." This became a model for Verdi's soprano-tenor duets.