Voting closed at 8 p.m. local time (0000 GMT) with exit surveys indicating a competitive race. About 90 minutes later, she had an eight point lead over Barack Obama with 24 percent of votes counted.
But analysts said in the run up to Tuesday that anything less than a double-digit win for Clinton would make Obama a clear favorite for the nomination as the party seeks a challenger to face Republican nominee-elect John McCain in November's presidential election.
Within minutes of CNN and other U.S TV networks all projecting a Clinton win, both sides had representatives spinning the results for their candidate.
Clinton's campaign chairman Terry McAuliffe said: "What happened is, I think, with the voters here in Pennsylvania,... they trusted Hillary Clinton on the issues of health care, job creation, to deal with the international crises that may come about."
Pennsylvania Sen. Bob Casey, an Obama supporter, said: "I think he's got a strong foundation now to go forward, be the nominee, but most importantly to have a foundation for the fall to beat John McCain in what will be a tough contest."
Early exits polls indicated Obama scored big with new Democratic voters in the state while Clinton fared better with voters who made up their mind in the final days of campaigning. They also indicated the economy was the number one issue.
Obama currently leads in the delegate count and the popular vote and has won more states. With just a handful of smaller states still to vote, a win for the senator for Illinois on Tuesday would be decisive, analysts say. Watch Obama sum up the Pennsylvania race »
Obama called Pennsylvania an "uphill climb," but said his campaign has showed he can compete in a big state.
He added: "We've won twice as many states, we've won the popular vote by fairly substantial margins, we've got a very big lead in pledged delegates and we competed, win or lose."
Clinton, a New York senator who enjoys core support among traditional Democratic voters, has remained in the White House race thanks to a series of wins in bigger, delegate-rich states including Ohio, Texas, California and her own state of New York. Watch Clinton on the Pennsylvania campaign trail »
In Pennsylvania, Clinton also had endorsements from the state's leading Democrats, including Gov. Ed Rendell and the mayors of Philadelphia and Pittsburgh, the state's two largest cities.
"What's important is that we turn out the vote because all of my plans, and all of the hard work that I am offering to make it possible for us to see the results of presidential leadership that makes a difference in the lives of Americans, can't happen unless we win," Clinton told supporters at a rally Monday at the University of Pennsylvania where she was joined by husband, U.S. President Bill Clinton, and daughter Chelsea Clinton.
She told ABC TV Tuesday: "I have to win. I believe that's my task. And I'm going to do everything I can to win."
A CNN poll of polls on the eve of the Pennsylvania primary gave Clinton a seven-point advantage over Obama, 50 percent to 43 percent with seven percent undecided.
Analysts say a big win for Clinton could propel her back into the race. With neither candidate expected to gain a simple majority of delegates before August's Democratic Convention, the nomination could be decided among the party's 800 "superdelegates" -- state governors, members of Congress and party leaders and officials -- among whom Clinton continues to hold influence.
"If Clinton wins by more than 10 points, which was her margin in neighboring Ohio and New Jersey, her campaign will have new momentum and she will soldier on," said Bill Schneider, CNN senior political analyst.
"If Clinton wins by single digits, we're in a political twilight zone. Nothing changes." But if Obama scores an upset, Schneider said, "Clinton will face tremendous pressure to end her campaign rather than damage the party."
Obama played down his chances of a surprise victory despite outspending Clinton by about $7 million to her $2.7 million in the state. His hopes rest on a strong performance in Philadelphia where he is expected to do well among African-American voters, among large numbers of newly registered voters and in the city's wealthier suburbs.
And with 50 of the 103 elected delegates at stake concentrated in seven of state's 19 congressional districts, six of those centered around Philadelphia, Obama could perform strongly enough to blunt the damage of a Clinton victory.
"It's going to be close... we are going to do a lot better than people expect," Obama told a Pittsburgh radio station, this week, The Associated Press reported.
Asked by CNN's Wolf Blitzer whether Clinton had to win big to stay in the race, John Murtha, a Pennsylvania congressman who has backed the Clinton campaign, said: "Well, she has to. That's all there is to it."
Pennsylvania is also holding a Republican primary, but McCain has already secured the 1,191 delegates needed to win his party's presidential nomination.