With the July 4th holiday upon us, both Presidential campaigns have reasons to be encouraged. After a slew of negative economic news and worrying poll numbers in April and May, Barack Obama has had a good few weeks, and the Supreme Court’s ruling on health-care reform capped it off. Chief Justice John Roberts’s legal two-step cruelly robbed Mitt Romney of the opportunity to portray his rival as a quasi-socialist violator of the Constitution. But the G.O.P. candidate is still in a much stronger position than he was three months ago, when he scraped through the Wisconsin primary and finally brought to an end Rick Santorum’s candidacy.

Both sides have said that the election is going to be close, and there is no reason to doubt it. For now, though, the momentum is running in favor of Obama, who is taking a few days off before embarking a bus tour of Ohio and Pennsylvania. His victory in the high court buoyed the spirits of everyone in Democratic Party, and it wasn’t the only good news that last week brought him. A number of opinion polls taken before the Supreme Court’s decision suggested that his campaign’s Plan B, which was adopted in wake of the economic slowdown earlier this year, is starting to bear fruit.

Plan A was to say that the hard slog of the past four years had been worth it, and that the economy was finally recovering. For an incumbent, this is a pretty standard message: things are getting better—stick with me. Over the winter, when job growth appeared to be perking up, it looked like a winning strategy, but then came the job figures for March, April, and May, which showed the growth in payrolls falling sharply. This Friday, the Labor Department will release the job report for June. Wall Street is expecting the payroll figure to come in at about a hundred thousand. Anything below seventy-five thousand would be another big blow to the White House; anything over a hundred and fifty thousand would be bad news for Romney, whose campaign has gone all in on the notion that the economy needs a new savior.

The Obama campaign’s Plan B is based on the assumption that the economy will continue to stutter along without slipping, once again, into an outright slump, which would probably insure a Romney victory. The basic idea is to try to neutralize the economic headwinds by changing the subject as often as possible, and by raising doubts about Romney’s record, both at Bain Capital and as the governor of Massachusetts. “We’ve got to make sure people fully appreciate Mitt Romney is not some safe alternative,” David Plouffe, one of Obama’s senior advisers, told the Times. Assuming the economy doesn’t get any worse, Obama’s strategists believe that they can eke out a narrow victory by mobilizing the same coalition that the campaign relied on in 2008—young people, minorities, women, and highly educated professionals—and by turning enough white working-class voters against Romney to deprive him of the surge in the Midwest that he needs in order to win.

A month ago, with the national and battleground state polls showing Romney cutting into Obama’s lead—and in some places surpassing him—Plan B seemed like wishful thinking. More recently, however, the polls have shifted in Obama’s favor. In the national head-to-head match, the Real Clear Politics average of recent polls shows him leading Romney, 47.6 per cent to 44.1 per cent. On June 18th, just two weeks ago, the difference between the two candidates was less than one percentage point. Now, an Obama lead of 3.5 percentage points shouldn’t be exaggerated: Romney is still within striking distance. But his post-primary surge seems to have come to an end, and recent local polling suggests that he is facing difficulties in some key battleground states.

A survey by Quinnipiac University of voters in Florida, Ohio, and Pennsylvania showed Obama ahead in all three states—by four points, nine points, and six points, respectively. If Obama wins all three states in November, he will be virtually assured of victory. Even if he wins two out of three, he will be very well placed.

In Florida in particular, Obama’s recent gambit on immigration policy appears to be paying off. Among Hispanic voters, his lead over Romney has increased from ten points before the immigration announcement to twenty-four points, according to the Quinnipiac poll. This surge in Hispanic support is enough to give Obama a four-point lead in the head-to-head matchup, despite the fact that his approval rating among Floridians as a whole (forty seven per cent) is still lower than his disapproval rating (forty nine per cent).

In Ohio, meanwhile, which is a must-win state for Romney, Obama’s hefty lead is based on his strong support among women, blacks, and independents. According to Quinnipiac, the gender gap is a stunning fifteen points. Among female voters, Obama leads Romney fifty per cent to thirty-five per cent. He is also doing a good job of attracting support from independents, where he leads by nine points. These are alarming figures for Romney. If he loses Ohio, the electoral-college math becomes forbidding. Obama’s support among Ohio women and independents is so strong that it almost makes up for his chronic weakness among white men, which has always been his biggest vulnerability. Among white voters of both sexes, he is now trailing Romney by just four points: forty-five per cent to forty-one per cent.

What is driving these figures? Ohio’s economy is doing fairly well, and that is certainly helping Obama, but so is the fact that Romney just isn’t popular there. His favorability rating is thirty-two per cent, according to Quinnipiac, and his unfavorability rating is forty-six per cent. The Obama campaign believes that its negative ads about Bain Capital, which have running in Ohio and other states during recent weeks, are having the desired effect, and that might well be true. In the latest NBC News/Wall Street Journal poll of voters in swing states, one in three of them said that seeing or hearing about Romney’s business record made them view him more negatively, and just one in six said that it made them take a more positive view of him.

It’s no secret that negative advertising works, or that the Mittster has his problems with Joe Sixpack. His campaign’s primary response will be to double up on its own attacks on Obama, whose favorability rating in Ohio of fifty per cent is a whopping eighteen points higher than Romney’s. With the wads of cash that are flowing into the coffers of the G.O.P. campaign and its allied Super PACs, viewers in Ohio and other swing states won’t be able to turn on their television sets this summer without seeing another spot impugning the President and his works.

One of the indictments will be that he passed Obamacare: the Supreme Court ruling won’t change that. But it has already changed the political dynamics surrounding the health-care issue. After three months of setbacks and the emergence of internal squabbling about his campaign strategy, the President badly needed a win, and he got a huge one. Regardless of all the polling that shows the individual mandate is still unpopular, that victory should not be underestimated.