Successful cities nearly all have something in common: leadership that can figure out where the community needs to go and can execute a plan to take it there. Fifteen years ago, it seemed inconceivable that Springfield, Mass., could be described in such terms. But after almost collapsing into bankruptcy, Massachusetts’ third-largest city is in the best shape it’s seen for more than a generation.

Heading into the 21st century, financial mismanagement wasn’t just a problem in Springfield, but a perennial habit. The city kept its property tax records on filing cards and budgeted as if it could collect 100 percent of the revenues that were owed, even though it continually fell millions of dollars short. As a result, Springfield ran deficits for 18 unbroken years. By the time a state control board took over in 2004, the cumulative deficit was, in fact, twice as big as city officials themselves realized -- $41 million, not the $20 million estimated.

Springfield’s finances were too big a mess even to qualify it for junk bond status. The credit rating agencies couldn’t get enough information out of the city to be able to rate it, so they gave up. “A deficit that was twice as high as they thought -- what does that tell us about the condition of the city at the time?” asks Stephen Lisauskas, who served as executive director of the state control board.

City officials knew very little about what was happening under their own roof. They were unsure how many employees they had or the extent of their health-care costs. Timesheets were done on paper, using an honor system that was barely honored.

During its five years in charge of Springfield, the control board restructured city departments, laid off employees and ran a rigorous performance measurement program, using data to keep track of what was going on. Mayor Domenic Sarno, who was first elected in 2007, has helped put in place real-time accounting systems that allow agencies to respond promptly when changes are called for. “If you manage your people costs, you’re freeing up money for all the other investments needed in the city,” says T.J. Plante, the city’s finance director.

Springfield now has real-time crime analysis that takes advantage of cameras all over the city, including newly negotiated body cameras worn by the police. The schools have improved: High school graduation rates are up 56 percent over the past five years, and the dropout rate has been cut in half. After a tornado ripped through town in 2011, city officials used federal funds strategically, melding their own investments and infrastructure planning with economic development projects. Previously, public and private investment had rarely been knitted into coherent long-range plans. A big downtown casino and a rail car manufacturing plant are now starting to have spinoff effects, with a total of $3 billion worth of public and private development projects at various stages of construction and planning.

Springfield is not a renewed paradise. Nearly 1 in 4 residents lives in poverty, and more than half of schoolchildren qualify for free or reduced meals. It has not been able to overcome the larger economic forces that have kept Boston booming while Western Massachusetts keeps slipping behind. City pension plans are still sorely underfunded. But Springfield’s credit rating is now the highest it’s ever been. Housing prices have been perking up after decades in the doldrums, showing that people are willing to invest in a city that has finally figured out the proper ways to invest in itself.