2012 United States presidential election in Pennsylvania

The 2012 United States presidential election in Pennsylvania took place on November 6, 2012, as part of the 2012 United States presidential election in which all 50 states plus the District of Columbia participated. The primary election to select the Democratic and Republican candidates had been held on April 24, 2012. Pennsylvania voters chose 20 electors to represent them in the Electoral College via a popular vote pitting incumbent Democratic President Barack Obama and his running mate, Vice President Joe Biden, against Republican challenger and former Massachusetts Governor Mitt Romney and his running mate, Congressman Paul Ryan. Pennsylvania's electoral vote number was a reduction from the 2008 delegation, which had 21 electors. This change was due to reapportionment following the 2010 United States Census. Pennsylvania's 20 electoral votes are allotted on a winner-take-all basis.

Democratic incumbent President Barack Obama received 51.97% of the vote, beating Republican challenger Mitt Romney's 46.59%. Also on the ballot were physician Jill Stein of the Green Party and former New Mexico Governor Gary Johnson of the Libertarian Party, who received 0.37% and 0.87%, respectively. Other candidates could run as write-in candidates, which received a total 0.2% of the vote. The state had been considered likely, but not certain, to go to Obama. While the state had voted for a Democrat since 1992, it remained competitive, especially after Bush's loss of only 2.5% in 2004. Its competitiveness was attributable to the stark contrast between the state's diverse, urban voters in areas such as Philadelphia and Pittsburgh; and rural, blue-collar voters in the rest of the state. However, massive margins in the urban regions of the state and victories in the Philadelphia suburbs, Lehigh Valley, Scranton, and Erie delivered a considerable victory for the president. Regardless, Romney improved on John McCain's 10.32% loss in the state in 2008, and flipped five counties that voted for Obama four years prior.

Five counties that voted for Obama in 2008 voted for Romney in 2012. This included Cambria County, which made Obama the first Democrat to win the presidency without carrying the county since Woodrow Wilson in 1916. Chester County, a Philadelphia suburb, also voted for Romney, though it would flip back into the Democratic column in 2016 and remain there in 2020. Obama became the first Democrat to win the White House without carrying Elk County since Franklin D. Roosevelt in 1940, and the first to do so without carrying Carbon County since John F. Kennedy in 1960. As of the 2020 presidential election, this is the last time that Chester County voted for the Republican candidate and the last time that Luzerne County voted for the Democratic candidate. This is also the last time Pennsylvania voted more Democratic than the nation as a whole. This remains the most recent presidential election where Pennsylvania voted to the left of Colorado and Virginia and to the right of Wisconsin and Iowa.

Democratic primary
Incumbent Barack Obama ran unopposed on the Democratic primary ballot. He received 616,102 votes. There were 19,082 write-in votes. In the floor vote taken at the Democratic National Convention, 242 Pennsylvania delegates voted for Obama, while the other 8 of the state's 250 allocated votes were not announced.

Republican primary
Four candidates were on the Republican primary ballot: Mitt Romney, former Senator from Pennsylvania Rick Santorum, U.S. Representative from Texas Ron Paul, and former Speaker of the House Newt Gingrich. His home state was set to be the make-or-break primary for Santorum. He had just lost 3 primaries to Romney, and Romney appeared poised to become the presumptive nominee by achieving a prohibitive lead.

As momentum in the Republican race built for Romney, Santorum suspended his campaign for four days to meet with 'movement conservatives' to strategize. Rather than returning to campaigning the next Monday, Rick and Karen Santorum canceled campaign events scheduled right after Easter weekend to be in the hospital with their youngest daughter.

In deference to the sick child, Romney ceased airing attack ads, replacing them with positive introductory ones.

On April 10, Santorum formally suspended his campaign. On May 7, he endorsed Romney. Santorum and Gingrich both released their delegates to Romney in August, shortly before the Republican National Convention.

Polling
In statewide opinion polling, incumbent Barack Obama consistently led challenger Mitt Romney by a margin of between 2 and 12 percentage points. Analysts rated Pennsylvania as a "likely Democratic" or "Democratic-leaning" state in the presidential race. On the morning of the election, polling aggregator FiveThirtyEight estimated that there was a 99% likelihood that Obama would win Pennsylvania's electoral votes. At the time, Pennsylvania's electoral votes had gone to the Democratic candidate in every presidential election since Bill Clinton won it in 1992. The average of the last three polls had Obama leading Romney 51% to 46%, which was very close to the actual result.

During the summer, there was significant spending on political advertisements in Pennsylvania, by both the Obama campaign and pro-Romney groups such as Crossroads GPS and Americans for Prosperity. However, because Obama maintained a consistent lead in polling, Pennsylvania came to be considered a "safe state" for Obama, and campaign advertising subsided substantially in August. This changed in October, when pro-Romney groups Restore Our Future and Americans for Job Security spent $3 million on advertising in Pennsylvania. Later that month, the Obama campaign and the Romney campaign both launched their own advertising campaigns in Pennsylvania. On November 1, the Republican National Committee announced that it would spend $3 million on television ads in Pennsylvania in the final days of the campaign. In total, pro-Romney spending in Pennsylvania was estimated to amount to as much as $12 million, much more than Obama campaign spending. The Obama campaign characterized the pro-Romney spending surge as "an act of sheer desperation", while the Romney campaign argued that they had a realistic chance of winning the state. In the end, Obama carried the state by a modest margin, albeit narrower than his 2008 landslide over Senator John McCain.

By county
[[File:Pennsylvania County Flips 2012-fixed.svg|thumb|County Flips:

Democratic {{legend|#92c5de|Hold}}

Republican {{legend|#f48882|Hold}} {{legend|#ca0120|Gain from Democratic}} ]]

Counties that flipped from Democratic to Republican

 * Berks (largest city: Reading)
 * Cambria (largest city: Johnstown)
 * Carbon (largest borough: Lehighton)
 * Chester (largest city: West Chester)
 * Elk (largest city: St. Marys)

By congressional district
Despite losing the state overall, Romney won 13 of the 18 congressional districts.