He had undergone surgery in June 2009 to replace his aortic valve and gallbladder surgery a month later. He had a pacemaker inserted in 1991 and was hospitalized eight years later with a heart attack. In early 2001, he was hospitalized with pneumonia.
Koch was born in the Bronx on Dec. 12, 1924, the second of three children of Polish immigrants Louis and Joyce Koch. During the Depression the family lived in Newark, N.J.
The future mayor worked his way through school, checking hats, working behind a delicatessen counter and selling shoes. He attended City College and served as a combat infantryman in Europe during World War II, earning his sergeant stripes.
He received a law degree from New York University in 1948 and began practicing law in Manhattan's Greenwich Village neighborhood, where his political career began as a member of the Village Independent Democrats, a group of liberal reformers. He defeated powerful Democratic leader Carmine DeSapio, whose roots reached back to the corrupt Tammany Hall political machine, in a race for district leader.
Koch was elected to the City Council and then to Congress, serving from 1969-77 as representative for the "Silk Stocking" district that was then known for its millionaire Park Avenue constituency.
The liberal Koch was the first Democrat to represent the district in 31 years. But his politics edged to the center of the political spectrum during his years in Congress and pulled to the right on a number of issues after becoming mayor.
His answer to the war on drugs? Send convicted drug dealers to concentration camps in the desert. Decaying buildings? Paint phony windows, complete with cheery flowerpots, on brick facades. Overcrowded city jails? Stick inmates on floating prison barges.
Koch defeated incumbent Beame and future Gov. Mario Cuomo in the Democratic primary to win his first term in City Hall. Like his hero Fiorello LaGuardia, the fiery fusion party mayor who ran the city from 1933 to 1945, he ran on the Republican and Conservative party lines in the 1981 mayoral election.
He breezed to re-election in both 1981 and 1985, winning an unprecedented three-quarters of the votes cast. At the time, he was only the third mayor in city history to be elected to three terms.
While mayor, he wrote three books including the best-seller "Mayor," ''Politics" and "His Eminence and Hizzoner," written with Cardinal John O'Connor. He wrote seven other nonfiction books, four mystery novels and three children's books after leaving office.
Early in his second term, Koch flip-flopped on his pledge to remain at City Hall and decided to run for governor against then-Lt. Gov. Mario Cuomo. But his 1982 gubernatorial bid blew up after Koch mouthed off about life outside his hometown.
"Have you ever lived in the suburbs?" Koch told an interviewer who asked about a possible move to Albany. "It's sterile. It's nothing. It's wasting your life."
It cost him the race, but it convinced many of the 8 million city residents that Koch belonged in New York. Meanwhile, Cuomo went on to serve three terms as governor.
Koch's third term was beset by corruption scandals. Queens Borough President Donald Manes — a close ally — committed suicide in March 1986, after having resigned over kickback and patronage allegations. Bronx Democratic leader Stanley Friedman and three others were also tarred. Koch's commissioner of cultural affairs, former Miss America Bess Myerson, stepped down in the wake of a scandal involving her boyfriend and a judge overseeing a legal case concerning him.
As the pressure grew, Koch suffered a minor stroke in 1987.
The administration was also beset by racial unrest, first after the 1986 death of a black youth at the hands of a white gang in Howard Beach and three years later after a black teen was shot to death in Brooklyn's tough Bensonhurst neighborhood by a group of whites.