The relative position of the candidates was evident in their visits to the state last weekend.

Mr. McCain spoke to a few thousand people in Concord, in Cabarrus County, which is an exurb of Charlotte and which voted lopsidedly in 2004 for Mr. Bush (67 percent to 33 percent). On a sunny Saturday morning, Mr. McCain’s audience seemed made up mainly of his base. They cheered loudly when he mentioned Ms. Palin and “Joe the Plumber,” the Ohio man who has become a symbol of Mr. McCain’s newly fashioned economic message, that Mr. Obama’s statement about wanting to “spread the wealth around” revealed him to be a socialist.

Mr. McCain had spoken briefly the week before in Wilmington (also Bush country), but until then he had not visited the state since the May primaries. His plea was blunt: “We have to win the state of North Carolina, and I’m counting on you to do it.”

On Sunday, in a fortuitous bit of timing, Mr. Obama spoke in Fayetteville, dense with military families, in his first appearance after being endorsed by former Secretary of State Colin L. Powell.

Mr. Obama’s visit to the area, which voted marginally for Mr. Bush in 2004, was his sixth trip to the state since the primaries, and he was reaching beyond his base.

“The men and women from Fayetteville and all across America who serve in our battlefields may be Democrats and Republicans and independents, but they have fought together and bled together and some died together under the same proud flag,” Mr. Obama said.

Image Jason Waller, left, in an Obama mask, and Elazbeth Waller as Gov. Sarah Palin while Senator John McCain talks in Concord, N.C., on Saturday. Credit... Carolyn Kaster/Associated Press

The state is one of the fastest-growing in the country, becoming home to more immigrants as well as transplants from other states who tend to be more moderate than the natives. This means both a less conservative electorate and a labor force that is growing faster than the supply of jobs.