The contract agreement Baltimore has reached with city firefighters is an example of the good that can come out of difficult negotiations when both sides are willing to make concessions. Neither the city nor the firefighters got everything they wanted, but they were able to strike a deal that allowed both of them to come out ahead. Compromise, it turns out, need not always be a dirty word.

Under the agreement, the firefighters will get a 16.5 percent pay raise over the next three years in exchange for accepting a longer workweek, which will increase from 42 to 47.5 hours. The longer workweek, in turn, will allow the city to cut costs on overtime pay and shrink the department by up to 140 firefighters through attrition, resulting in savings of about $72 million over the next nine years. It's a win-win situation for the city and its employees.

Under the new contract, the firefighters will be on duty for two 24-hour shifts over three days, followed by five days off. Nationally, Baltimore up to now has been one of the few large cities with workweeks that are as short as 42 hours, so the 5.5 hours added to the firefighters' schedule brings the city more in line with departments elsewhere.

Meanwhile, Mayor Stephanie Rawlings-Blake should be even more pleased by the agreement if it paves the way toward a less-contentious relationship with the city's other public employee unions. Despite their initial differences, what came out of the closed-door bargaining sessions is good for the city as well as those who work for it.

Moreover, the new contract is crucial to the mayor's 10-year plan to address a projected $750 million financial shortfall over the next decade. Though the savings from the firefighters' contract represent only a fraction of that amount, it's an important step toward solving the long-term problem of balancing the city's books.

Earlier this year, Ms. Rawlings-Blake outlined an ambitious proposal to fix the city's finances by tackling the nearly $700 million in unfunded pension liabilities owed to municipal employees. That plan would require Baltimore's non-public-safety workers to contribute 1 percent of their salaries to the pension fund this year and increase those contributions in each of the next five years until workers contribute 5 percent. Ms. Rawlings-Blake suggested that the trade-off for requiring municipal workers to contribute to their pensions would be a 10 percent salary boost for employees over the next five years.

The firefighters' contract is clearly in line with those goals. Getting Baltimore's pension system under control is critical to making progress on every other issue facing the city today, from lowering property tax rates and growing the population to reforming the public schools and demolishing the city's stock of vacant and blighted housing.

Ms. Rawlings-Blake is methodically chipping away at the problem, and coming to an agreement with the city's firefighters that doesn't break the bank allows her to claim an important victory. But her win this time isn't the firefighters' loss. Instead, it's an example of what can come out of a cooperative effort that allows both sides to come away feeling that they've gotten what they need, and that's always a good thing.