PHILADELPHIA (AP) — Republican Tom Corbett, the state attorney general who shook up the Pennsylvania Capitol with his prosecution of corruption in the Legislature, sailed past Democratic opponent Dan Onorato on Tuesday to claim the governorship of a state President Barack Obama carried just two years ago.

Returns from 97 percent of the state’s precincts showed Corbett with 54 percent of the vote and Onorato with 46 percent.

Listen to Corbett’s Victory Speech …

At Corbett’s election-night headquarters at a Pittsburgh hotel, there was wild cheering when a local TV station reported that The Associated Press had declared him the victor.

“I want to thank the people of Pennsylvania. Thank you for your votes, thank you for your confidence in me, and I promise you I’m going to work very hard for the people of Pennsylvania,” Corbett said.

Across town, Onorato was gracious in defeat.

“It’s been a two-year battle. It’s a tough environment out there, but I’ve got to tell you, I enjoyed it. I got into this race to talk about ideas,” he told supporters gathered in a union hall in another part of the state’s second-largest city. “We fought the battle. We came up a little short today, but our voice was heard.”

The gubernatorial campaign, which was occasionally drowned out by the noisier contest for Arlen Specter’s U.S. Senate seat, focused primarily on spending and taxes as the state government faces a projected budget shortfall of as much as $5 billion for the fiscal year starting July 1.

But it also revolved around the question of whether the state should tax natural-gas drilling on the lucrative Marcellus Shale reserve; government reform; and the candidates’ track records.

Independent polls showed Corbett as the front-runner throughout the post-primary campaign.

One Corbett supporter at the hotel celebration was a Pittsburgh woman who said she was a longtime Democrat who switched parties to support Corbett.

“I switched over to Republican just in the last month,” said Janine Macklin, 33. “I’m excited. I think he’s the right man for the position. Corbett has a good work ethic, and I’m excited about what he’s going to do for Pennsylvania.”

Corbett, 61, is a career prosecutor who has been the state attorney general since 2005. He has run largely on his office’s ongoing probe of corruption in the Legislature, which has resulted in 10 convictions or guilty pleas and sent a former legislative leader and a former aide to prison. Thirteen other current or former lawmakers and aides are awaiting trial.

Onorato, 49, has run the government in Allegheny County, where Pittsburgh is, as its elected executive since 2004. He touted his success in streamlining the bureaucracy and holding the line on property taxes throughout his tenure.

Gov. Ed Rendell, a Democrat and former Philadelphia mayor, is stepping down in January after serving the maximum two terms allowed by law. Onorato is also from the Pittsburgh area.

Corbett pledged that he would not increase any state taxes or fees, while Onorato promised not to raise the personal-income, sales or gasoline taxes. Both men vowed to cut similar lists of corporate taxes to help enhance the state’s business climate, and Corbett has promised to phase out the state inheritance tax.

But during months of campaigning and three televised debates, neither candidate spelled out spending cuts that would come close to closing a $5 billion budget gap.

The issue of taxing natural gas drilling was a defining issue in the campaign.

Onorato advocated a new tax to raise money for environmental protection, including a fund to help local communities repair drilling-related damage to roads, water systems and other infrastructure. He charged that Corbett’s opposition stemmed from the more than $355,000 he received in campaign contributions from the industry since the beginning of the year.

Corbett said he opposed the tax because it could be a setback for an industry that’s expected to create thousands of new jobs. In TV ads, he accused Onorato of supporting an “energy tax” that would drive up electricity bills.

Between them, the candidates raised more than $40 million for their campaigns and spent much of it on TV attack ads.

Corbett’s biggest contributions came from the Republican Party, including $6 million from the Republican Governors Association, and wealthy individuals. Onorato’s largest donations came from organized labor, trial lawyers and the party, including $1.4 million from the Democratic Governors Association and more than $300,000 from Rendell’s political committee.

Both candidates faced unusual challenges.

Corbett revealed a tendency to make gaffes in public speaking, including his conflicting explanations about which levies his no-tax pledge covered, which became fodder for Onorato’s TV ads suggesting that Corbett was not gubernatorial material.

Onorato faced such difficulty in building name recognition that he resorted to airing a TV ad in which he said his last name as he held up a placard on which it was spelled out in capital letters.

(© Copyright 2010 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)