Former New York City mayor Ed Koch died on Friday at age 88 after a year of repeated hospitalizations, a spokesman for Koch said.

As mayor from 1978 to 1989, the forceful, quick-witted Koch, with his trademark phrase "How'm I Doing?," was a polarizing figure and the city's constant promoter.

Koch died of congestive heart failure at about 2 a.m. (0700 GMT) at New York-Presbyterian hospital, the spokesman for Koch said.

Koch was credited with lifting New York from crushing economic crises to a level of prosperity that was the envy of other U.S. cities. Under his leadership, the city regained its fiscal footing and undertook a building renaissance.

But his three terms in office were also marked by racial tensions, corruption among many of his political cronies, the rise in AIDS and HIV, homelessness and a high crime rate. In 1989, he lost the Democratic nomination for what would have been a record fourth term as mayor.

Mayor Michael Bloomberg said the flags at all city buildings would fly at half-staff in Koch's memory.

"In elected office and as a private citizen, he was our most tireless, fearless, and guileless civic crusader," Bloomberg said. "His spirit will live on not only here at City Hall, and not only on the bridge the bears his name, but all across the five boroughs."

Koch had a quip for every occasion and once said he wanted to be mayor for life. He was the only U.S. mayor to have a bestselling autobiography that was turned into an off-Broadway musical.

This week, "Koch," a documentary about his turbulent three terms as mayor, premiered at the Museum of Modern Art. Koch was unable to attend the premier.

"I don't think there was anybody who had more fun being mayor as Ed Koch," City Council Speaker Christine Quinn, who is in the race to be the city's next mayor, said at the premier.