PHILADELPHIA—Despite a last-minute frenzy for Pennsylvania's electoral plenty, John McCain failed to switch this traditionally blue state, which awarded its 21 votes to Barack Obama and helped him win the presidency.
Polls closed at 8 p.m. and, moments later, based on exit poll data, NBC called the state for Obama.
Although Pennsylvania has not voted for a Republican presidential candidate in 20 years, it was seen by many political analysts - and the McCain campaign - as a potential Election Day surprise. Some recent polls had Obama's lead narrowed to single digits.
"They saw they could turn the state," said Todd Elerby, an assistant professor at St. Mary's College in Southern Maryland who on Monday had projected a McCain win based on Pennsylvania. "Their statewide data and trends consistently ran counter to the nation, and McCain's campaign saw that and focused tightly there."
But a huge Democratic turnout in Philadelphia and its key suburbs, coupled with support in the Pittsburgh area, ensured that the Keystone State remained blue. For Democrats, the day's festival-like feel - Mayor Michael Nutter rode an Obama float through West Philadelphia - concluded with a returns-watching party at Finnegan's Wake, a pub in the Northern Liberties area.
By 10 p.m., with Pennsylvania's neighbor Ohio also called for Obama, a tuba player strode in, and Nutter and other party leaders were preparing to speak. Dressed in a full-body Superman costume with an Obama emblem, Robert Rush, 56, was cheered as he made his way through the crowds.
"We won this sucker," he said, as people nearby chanted "U-S-A!" "We did it."
Especially in the final few weeks, the McCain campaign dug its heels in the state. Either McCain or his vice presidential candidate, Alaska Gov. Sarah Palin, visited daily for the past week. Before heading west, McCain held a rally Monday outside Pittsburgh.
A more socially conservative Democratic state than most, Pennsylvania voted for Sen. Hillary Clinton in the primary by 10 percentage points over Obama. Republicans had hoped to convert some Clinton voters.
McCain's campaign also benefited significantly from high-profile gaffes by Obama and his associates. Among them: Obama's comment about small-town Pennsylvanians being "bitter." Obama and Sen. Joe Biden, a native of Scranton, have said they do not favor building new coal plants - a staple industry here.
And last month Rep. John Murtha, a 17-term congressman from Southwest Pennsylvania, was quoted as saying there is "no question that Western Pennsylvania is a racist area."
Murtha was the projected winner in his race, but it was closer than expected against a newcomer Republican.
Even before polls opened at 7 a.m., lines had formed at sites across the state, election officials reported. Pennsylvania has 8.75 million registered voters. The state is tied with Illinois for the fifth-highest number of electoral votes.
By late morning in Red Lion, lines at the town's main polling site, Pleasant View Brethren in Christ Church, had disappeared. Voters stood outside in the parking lot talking about McCain's long-shot chances.
Nearby, a white brick house displayed 12 McCain lawn signs and a giant banner. Political analysts called the conservative southern part of the state a must-win for McCain.
But G. Terry Madonna, director of the Floyd Institute's Center for Politics and Public Affairs, said Chester County, as well as other Philadelphia suburbs, would be the real challenge for McCain.
Both tickets have blitzed the state with visits in recent weeks; McCain and Biden held rallies here Monday.
Hundreds of politically active people from Maryland - a solidly blue state - commuted to Pennsylvania to volunteer.
Jake Carlo, 35, of Baltimore took two weeks off work to volunteer for Obama's York operation, one of 81 such offices in the state. McCain workers fielded 51 Pennsylvania offices.
"This is a battleground state," he said at the office in the historic district. "Maryland is not."
He said Obama volunteers would be "running until the very end" because Pennsylvania was "up for grabs."
Brendan Benner, Pennsylvania communications director for McCain, said the Republican resources pumped into the state made it clear they thought it was winnable.
Benner noted the number of undecided voters late in the race - 9 percent in some recent polls - as a reason for McCain to have been optimistic. He also said Pennsylvania saw an unusually high number of party-switchers this year, pointing to a Democrats for McCain office in Scranton.
Yesterday, McCain volunteers called more than 10,000 undecided voters, independent voters and some Democrats, Benner said.
"We are going right down to the last second," Benner said of McCain workers. "And, in the end, we're going to have no regrets."
The Associated Press contributed to this article.