Madrid's iconic Cafe Gijon, whose past clients include Ernest Hemingway and Salvador Dali, has won a last-minute reprieve from near certain closure.

The cafe had warned it would have to draw the curtain on its 120-year history after Madrid's cash-strapped City Hall granted the licence to its lucrative terrace to a higher bidder in July.

But the rival firm, Santa Engracia, which had bid 144,000 euros (($175,000), more than double the cafe's offer of 70,000 euros, decided in early August to surrender the concession.

"The Cafe Gijon is keeping its terrace," said a City Hall spokesman, confirming a report in the daily ABC, which said Santa Engracia had given up its business plans in the face of Spain's economic crisis.

ABC said the winning bidder had also been concerned about the uproar in cultural circles over the threat to Cafe Gijon, whose other regulars included Marcello Mastroianni, Truman Capote and Ava Gardner.

Shaded under the tall trees of the Spanish capital's Paseo de Recoletos boulevard, the literary cafe's outside tables had lured artists, writers and actors since 1888.

The cafe, which employs 42 staff, had said it would have to sell up if it lost the right to use the terrace, which generates 60-70 percent of its profits but is on land owned by the city.