“His goal is to win as many delegates as he can and have it turn into a squeaker,” said Tony Podesta, a Democratic operative who has run several statewide campaigns in Pennsylvania and is supporting Mrs. Clinton. “He’s been successful in other states, like Wisconsin, in taking an electorate that was favorable to her and through the investment of huge numbers of dollars on TV and lots of personal campaigning, has managed to turn that around.”

The Obama campaign has been laying the groundwork to do just that. It started with a concerted voter registration drive that ended on Monday. Analysts said many newly registered Democrats were probably Obama voters, partly because the typical Clinton voter  older and more established  was already registered.

The Obama camp has moved to what it calls the persuasion phase of its campaign. It has already spent more than $2 million on television and radio; Mrs. Clinton, who has less money but is better known, has spent perhaps a third of his total.

One of Mr. Obama’s commercials is biographical, with good reason. Campaign officials say he still needs to introduce himself, while Mrs. Clinton has family roots in the state and has visited often since her husband’s first campaign here in 1992. Former President Bill Clinton and their daughter, Chelsea, have made several stops in Pennsylvania over the last two weeks.

Mr. Obama also faces demographic disadvantages. While he draws young people and those with college degrees, Pennsylvania has one of the highest concentrations of people over 65 (15 percent, compared with a national average of 12 percent) and one of the lowest of people with college degrees (22 percent, compared with a national average of 24 percent).

Few doubt that Mr. Obama will carry Philadelphia, where more than 40 percent of Democrats are African-American. It is also home to upper-income white liberals and students, two other groups that have supported him. At the same time, the city’s mayor, Michael Nutter, is working on behalf of Mrs. Clinton, as is the state’s popular governor and former Philadelphia mayor, Edward G. Rendell. Much of the city’s white working class also supports her.

If past elections are a guide, Mr. Obama’s success will lie in how much he can increase the turnout in Philadelphia and its surrounding suburban counties, with their pockets of affluent, educated white liberals. The suburbs are expected to be a major battleground.