Born into a wealthy Roman family, Costa studied from 1842 to 1845 at the Bandinelli College in Rome, where he came into contact with Vincenzo Camuccini. He served his pictorial apprenticeship with Francesco Coghetti and Francesco Podesti. Having abandoned his academic studies, he adopted a rigorous method of working from life under the influence of Jean-Baptiste Camille Corot, whom he met in Rome in 1843, and the Posillipo School, whose members he met during a stay in Naples in 1850–51. It was during this period that he began to spend time in Ariccia, where he produced his first views of the Roman countryside. From 1848 on, his intense activity as a landscape painter alternated with participation as a volunteer in the Italian wars of independence.
The meeting with the painter George Mason and above all the Pre-Raphaelite Frederick Leighton around 1852 had a marked impact on Costa’s work and steered him in the direction of symbolism based on study of the Italian primitives. The same period saw his first appearance on the English art scene, where he was to enjoy lasting commercial success. Attracted by the work of Giovanni Fattori, he came into contact with the group of artists who gathered in Florence at the Caffè Michelangelo in 1859.
Participation in the Esposizione Nazionale in Florence and the Paris Salon in 1861 marked the start of great involvement in exhibitions at the international level. In his maturity, Costa was the founder of various groups focusing on the direct study of nature and a return to the pictorial techniques of the Italian primitives in opposition to the official artistic culture.