A Baroque masterpiece valued at more than £9 million has been saved for the nation after an anonymous buyer stepped in to prevent it going overseas, it was announced today.

Italian master Domenichino's painting of Saint John the Evangelist, dating back to the 1620s, was owned for more than a century by the Christie family who run Glyndebourne opera house and it had been hanging in the organ room there in recent years.

It has now been put on public display at the National Gallery after the private collector came forward.

The artwork was bought by an overseas buyer for £9.2 million in December, but its export licence was deferred to enable efforts to save the work for the nation.

The oil painting, measuring 2 x 2.6 metres, is said to be the finest painting by Domenichino to remain in private hands, and the most important of his work in this country.

Domenichino's painting was done for the Giustiniani family, among Rome's most important collectors and in the early 17th century who also owned a dozen works by Caravaggio.

Attempts to find funds for the painting failed but with the deferral of the export licence by the Reviewing Committee on the Export of Works of Art and Objects of Cultural Interest (RCEWA), another collector emerged who pledged to allow regular public display.

Rules allow private offers if public access is available to artworks for 100 days within a 12-month period.

It will be on display at the National Gallery from for an 18-month period.

National Gallery director Dr Nicholas Penny paid tribute to the collector for their "imagination and confidence".

"The result is a triumph for the National Gallery, but also for enlightened legislation and its efficient administration," he said.

National Gallery curator Dawson Carr said: "Although Domenichino is well represented in UK public and private collections, none of the paintings can equal the grand scale and conception of this, one of his greatest easel paintings.

"It is undoubtedly the best work by the artist remaining in private hands and its export would have been lamentable for the representation of Italian Baroque painting in this country."