Boston Mayor Thomas Menino in 2007. (Elise Amendola/AP)

Thomas M. Menino, Boston’s longest-serving mayor, who gained support from working-class neighborhood “townies” and corporate chieftains alike during his 20 years in office and presided over a steel-and-glass economic boom in one of America’s most historic cities, died Oct. 30 in Boston. He was 71.

Hugely popular in his home town, where he easily won five straight nonpartisan mayoral elections before retiring from city hall, Mr. Menino, who was a liberal Democrat, surprised Boston in March with his disclosure that he had been diagnosed with an advanced form of cancer just weeks after completing his final term.

Doctors said they were unsure where in his body the disease had begun, but it had spread to his liver and lymph nodes by the time it was detected.

“I don’t want sympathy,” Mr. Menino told the Boston Globe in confirming his illness. From his office at Boston University, which he joined as an urbanpublic policy specialist after leaving city hall in January, he said: “There are people worse off than me. It’s my biggest concern — I don’t want to be treated any differently.”

His death was confirmed by the office of Boston Mayor Martin J. Walsh (D).

Part of what endeared Mr. Menino to many lifelong Bostonians was his common-man persona. Often blunt-spoken and given to malapropisms (he once called local parking problems “an Alcatraz around my neck”), he was thoroughly a creature of his city, innately attuned to its sardonic humor and idiosyncrasies.

Near the end of his political career, preceding the cancer diagnosis, he was beset by physical ailments, including blood clots, type 2 diabetes and Crohn’s disease. After the Boston Marathon bombing in April 2013, he rallied from a hospital bed and, clearly in pain during a memorial service, vowed that “nothing can defeat the heart of this city. Nothing — nothing — will take us down.”

Raised in a blue-collar household, his Boston accent so thick that even natives would occasionally miss a word or two, he was a former insurance salesman with modest academic credentials and no political aspirations higher than the mayoral suite. “Mayor Mumbles,” wags called him for his less-than-eloquent diction.

Some pundits argued that Mr. Menino lacked a grand vision for Boston, that he was an “urban mechanic” fixated on small-bore neighborhood issues. But there was no denying his sustained success at the polls.

His political machine, which the Globe called “the most extensive” in modern Boston history, relied on constituent services and favors delivered by city workers who (on their own time, it was said) also zealously promoted the mayor’s electoral interests.

In the style of an old-school urban boss, he was relentless in punishing political foes and generous to allies, including favored developers, who responded in kind with healthy donations to his reelection campaigns.

“He worked constantly and very, very hard,” said Maurice Cunningham, a political scientist at the University of Massachusetts in Boston. “I mean, Jesus, you’d see him, you’d say: ‘How you doing? Hey, we got a pothole on our street, Mister Mayor.’ And they’d be down there filling the pothole that afternoon. He didn’t miss a lot.”

So insistent was Mr. Menino that his staff answer residents’ phone calls that he refused to allow voice mail in city hall until his waning months in office.

While he attended almost every wake, school play and retail ribbon-cutting he could find time for, he also oversaw an economic renaissance — a major influx of high-tech employers, plus expansions of many of the area’s top-flight universities, hospitals and cultural institutions. The dazzling growth helped turn the city into what many consider a world-class metropolis, a dream of Boston mayors since the 1960s.

Much of the boom was fueled by economic forces having nothing to do with Mr. Menino, as well as by two massive undertakings — the $4 billion cleanup of Boston Harbor and the $24 billion highway-and-tunnel project known as “the Big Dig” — neither of which was a city initiative. Nevertheless, the mayor relentlessly championed the growth, muscling it along for years with tax incentives and other deals.

“Tom Menino had the big, bold, beating heart of a street politician,” Secretary of State John F. Kerry, a former Massachusetts senator, said in a statement. “He knew what built community. He felt the city and the neighborhoods in his bones.”

In 2006, Mr. Menino joined then-Mayor Michael R. Bloomberg of New York in organizing Mayors Against Illegal Guns, to advocate for stricter gun-control laws. The nonpartisan group, which began with 15 mayors, now includes more than 1,000 current and former top municipal officials from across the country, according to its Web site.

As with any chief executive of a multiethnic city rife with class disparities, especially one like Boston with its legacy of racial discord, Mr. Menino had his share of detractors. Although the mayor holds significant power over schools in Boston, Mr. Menino failed to improve the mediocre public-education system, critics said, and he did little to ease a shortage of affordable housing.

A Catholic in heavily Catholic Boston, Mr. Menino also drew the ire of traditionalists in the church for his support of same-sex marriage and abortion rights. Starting in 1995, he boycotted South Boston’s St. Patrick’s Day parade — a big event for local politicians — because organizers barred gay and lesbian groups from participating.

“For all the people I offended, I apologize,” he said in refusing to march. “But you have to stand up for your principles.”

Boston’s lesbian, gay, bisexual and transgender community responded by electing Mr. Menino grand marshal of its 2013 Pride Parade, as his career in city hall was winding down.

A poll in 2013 showed how popular he remained in his 20th year in office, with a 74 percent approval rating. To the amazement of people unfamiliar with Mr. Menino’s near-constant out-and-about mingling, the survey indicated that almost half the electorate in a city of 640,000 residents had met the mayor personally.

Within days of the poll, however, Mr. Menino, who had been hospitalized several times for an array of ailments, announced he would forgo a sixth term.

Less than a month later, on April 15, 2013, he was in a hospital again, recuperating from ankle surgery after a fall, when two bombs exploded near the Boston Marathon finish line, killing three people and injuring more than 260 others, 16 of whom lost one or both legs.

The jihadist-inspired attack allegedly was carried out by brothers Tamerlan Tsarnaev, 26, who died in a shootout with police four days after the bombing, and Dzhokhar Tsarnaev, then 19, who was captured and is awaiting a federal death-penalty trial. The siblings, immigrants from the former Soviet Union, lived near Boston.

Amid the worst public-safety crisis of his tenure, with a manhunt underway for the bombers, Mr. Menino repeatedly signed out of Brigham and Women’s Hospital that week to attend briefings, then checked back in at night.

At a prayer service in Boston’s grand Cathedral of the Holy Cross, the mayor, eschewing painkillers, rose unsteadily from his wheelchair, with a metal plate and screws in his right ankle. Wincing as he braced his bulky frame against the lectern, he declared in a raspy voice: “We are one Boston. No adversity, no challenge, nothing can tear down the resilience in the heart of this city and its people.”

He said, “I have never loved it, and its people, more than I do today.”

Thomas Michael Menino, son of a factory foreman and a homemaker, was born Dec. 27, 1942, in Boston’s working-class Hyde Park neighborhood, and he stayed there all his life. With a business degree from a junior college in 1963, he joined Metropolitan Life as an insurance salesman.

In a city where politics had been dominated by Irish Americans since the gaslight era, he would become the first mayor of Italian descent. He got his start as a ward heeler for a city council member, then won a council seat in 1983. At 45, he received a bachelor’s degree in community planning from the University of Massachusetts.

He was council president in July 1993 when he succeeded then-Mayor Raymond L. Flynn, who had been named U.S. ambassador to the Vatican. That November, interim-Mayor Menino won 64 percent of the vote in the general election. During his third term, in 2002, he was elected president of the U.S. Conference of Mayors.

In 1966, Mr. Menino married Angela Faletra, whom he met on a neighborhood tennis court. Besides his wife, survivors include two children, Susan Menino Fenton and Thomas M. Menino Jr., both of Boston; and six grandchildren.

He also is survived by “the Menino Room” in the back of an ancient saloon called Doyle’s Cafe, long a favorite watering hole of Boston politicians.

The rear seating area used to be named for Mayor John F. “Honey Fitz” Fitzgerald, a grandfather of President John F. Kennedy. When the owners rechristened it in Mr. Menino’s honor in 2003 — with plenty of toasts, laughter and back-slapping — there in the bar sat “Tommy from Hyde Park,” as he liked to call himself, reminiscing about his first day running the city.

“I stood at the rail in the mayor’s office,” he told the crowd in Doyle’s, “and I said to myself, ‘I’m boss; I’m mayor.’ I’ve come a long way, baby. Let me tell you.”

“He felt the city . . . in his bones.”

John F. Kerry, secretary of state