Pergolesi was born in Jesi, where he studied music under Francesco Santini there before going to Naples in 1725 where he studied under Gaetano Greco among others. He spent most of his life working in Neapolitan courts.
Pergolesi was one of the most important early composers of opera buffa (comic opera). His opera seria Il prigioner superbo contained the two act buffa intermezzo, La Serva Padrona (The Landlady Servant, 1733), which became a very popular work in its own right. When it was given in Paris in 1752, it prompted the so-called querelle des bouffons (quarrel of the comedians) between supporters of serious French opera by the likes of Jean-Baptiste Lully and Jean-Philippe Rameau and supporters of new Italian comic opera. Pergolesi was held up as a model of the Italian style during this quarrel, which divided Paris's musical community for two years.
Among Pergolesi's other operatic works are his first opera La concersione e morte di San Guglielmo (1731), Lo frate 'nnammorato (The friar in love, 1732), L'Olimpiade (1735) and Il Flaminio (1735). All his operas were premiered in Naples apart from L'Olimpiade which was first given in Rome.
Pergolesi also wrote a lot of sacred music, including a Mass in F. It is his Stabat Mater (1736), however, for male soprano, male alto and orchestra, which is his best known sacred work. It was commissioned as a replacement for the one by Alessandro Scarlatti which had been performed each Good Friday in Naples. The work remained popular, becoming the most frequently printed work of the 18th century, and being arranged by a number of other composers, including Johann Sebastian Bach, who used it as the basis for his motet Tilge, Höchster, meine Sünden, BWV 1083.
Pergolesi wrote a number of secular instrumental works, including a violin sonata and a violin concerto. A considerable number of instrumental and sacred works once attributed to Pergolesi have since been shown to be falsely attributed. Much of Igor Stravinsky's ballet, Pulcinella, which ostensibly reworks pieces by Pergolesi, is actually based on spurious works.
Pergolesi died at the age of 26 in Pozzuoli from tuberculosis.