Nationally, the economic picture is decidedly dismal — a sullen state of affairs that has led many political observers to conclude that President Obama is an underdog in his bid for a second term.

But in the 12 (or so) swing states — where Democrats and Republicans will spend the lion’s share of their time and money in the 100 or so days between now and Nov. 6 — the economic picture is considerably sunnier.

In seven of those 12 states — Iowa, New Hampshire, New Mexico, Ohio, Pennsylvania, Virginia and Wisconsin — the unemployment rate is below the June national average of 8.2 percent. In some, it is considerably less than the national average; the June rates in New Hampshire, Iowa and Virginia were below 6 percent. Even in Ohio, a state hit hard by the collapse of the manufacturing sector, the unemployment rate is a full percentage point below the U.S. average. Republicans note that the unemployment rate rose between May and June in Colorado, Iowa, New Hampshire and Virginia, among other swing states.

In the four swing states where the rate is above the national average — Florida, Michigan, Nevada and North Carolina — the trend line is headed downward. Nevada’s June unemployment rate was an eye-popping 11.6 percent, but that was down from 13.8 percent in June 2011. Ditto Florida (10.7 percent in June 2011, 8.6 percent now), Michigan (10.6 percent in 2011, 8.6 percent now) and North Carolina (10.6 percent in 2011, 9.4 percent now).

Viewed even more narrowly, of the eight states that the Fix considers the truest swing states this fall — Colorado, Florida, Iowa, Ohio, Nevada, New Hampshire, Virginia and Wisconsin — the unemployment rate is below the U.S. average in five, above it in two and right at the national number in one (Colorado).

If you allocated the electoral votes of those eight swing states solely based on the unemployment rate in each — giving the states with rates below the national average to Obama and those above it to Republican challenger Mitt Romney — the incumbent would claim 51 electoral votes, compared with 35 for Romney. Colorado and its nine electoral votes would be a push.

Add that total to the states already solidly behind or leaning toward each candidate on the Fix electoral map and Obama takes 288 electoral votes, more than the 270 he needs to win.

Now, simply assigning states to one of the two candidates based on the unemployment rate alone is a too-blunt measure. After all, the candidates — and the campaigns they run — matter.

But the state-by-state unemployment numbers are a reminder that the 2012 election — like all presidential contests — is a national election in name only. That is, although the U.S. unemployment rate matters as a broad thematic, the rates in the eight to 12 swing states may well be more telling indicators of whether Obama can sell voters on his plans for the economy. That handful of states is where the election will be decided; the unemployment rates in places such as California (10.7 percent in June) and North Dakota (2.9 percent) are, essentially, meaningless.

Even in the places where the unemployment rate is higher than the national average — particularly Florida — the downward trend line could (and we emphasize “could”) allow the incumbent to convince undecided voters that things are slowly but surely getting better.

On the other hand — and, yes, in politics there is always another hand — the highest the national unemployment rate has ever been when a president has won reelection is 7.2 percent, for Ronald Reagan in 1984. Of the 12 swing(ish) states, six had rates above 7.2 percent, while a seventh — Ohio — had exactly that 7.2 percent rate.

Make no mistake: The weak national economy has badly imperiled Obama’s chances of winning a second term in November. But the economic story in the swing states is slightly better for the incumbent, giving him and his team a glimmer of hope as they work to win in the fall.