With the soaring rhetoric that Americans have come to expect of their president, Barack Obama celebrated a victory that many had doubted could come to a leader embattled by a stubbornly slow economy.

Yet although the national vote was close, the key electoral battlegrounds fell to Obama again and again, denying former Massachusetts Gov. Mitt Romney the prize he has sought in two campaigns. It was a considerable personal triumph for the president.

For the future, though, there was good advice from Romney: “At a time like this, we can’t risk partisan bickering. Our leaders have to reach across the aisle to do the people’s work.”

We hope so.

If the mystic chords of union were touched in this kind of campaign, it was by accident, jostling the instrument on the way to put out a new attack ad.

It was the most expensive and in some ways very unsatisfying campaign, in which candidates too often stretched the truth and millions were spent without legal restriction by private individuals and groups with their own political axes to grind. The “fact checkers” in the national media were routinely snubbed — and ads untethered to reality bombarded voters in the swing states.

If there is a policy lesson, we hope it is that the nation if closely divided nevertheless endorsed the president’s ambitions for compromise on the tough issues facing a lame-duck Congress that returns next week.

This national result was a vote for constructive compromise, not ideological rigidity. A spirit of pragmatism, indeed forbearance toward the other side, is necessary if the government is to be carried on in these political circumstances.