The church was built at the expense of the citizens of Rome in honour of a miraculous image of the Virgin which halted a pestilence in 1656. It was designed by Carlo Rainaldi
in the late Baroque style between 1659 and 1667, replacing an older church on the site. Construction was ordered by Pope Alexander VII
after the icon of the Madonna kept in the church was believed to have saved the city from plague in 1656 (or 1658). The image was kept in the church of the nearby Spedale di S. Galla. The Senate of Rome and Pope Alexander VII felt that the image deserved a better setting and financed the building of a new church.
The church is built on the site of the antique Roman Temple of Jupiter Stator.