The former first lady was winning 53 percent of the vote Tuesday night, compared with 47 percent for her rival. She hoped for significant inroads into Obama's overall lead in the competition for delegates to the Democratic National Convention.
Clinton scored her victory by winning the votes of blue-collar workers, women and whites in an election where the economy was the dominant concern. More than 80 percent of voters surveyed as they left their polling places said the nation was already in a recession.
Trailing in the national delegate chase and outspent badly in the state, Clinton needed a win to sustain her candidacy. She projected confidence by scheduling a rally in Philadelphia after the polls closed.
Obama, the front-runner, had already said he expected to lose, but narrowly, and worked to limit any erosion in his delegate lead. Even before the polls closed, he flew off to an evening rally in Indiana, one of two states with primaries on May 6. North Carolina was the other, and both campaigns have been airing television commercials in both for weeks.
The six-week run-up to the primary was notable for close-to-the-ground campaigning normally reserved for the early-voting states of Iowa and New Hampshire, and for the decidedly negative tone of its final few days.
Flush with cash, Obama reported spending $11.2 million on television in the state, compared with $4.8 million for Clinton.
The tone of the campaign was increasingly personal.
"In the last 10 years Barack Obama has taken almost $2 million from lobbyists, corporations and PACs. The head of his New Hampshire campaign is a drug company lobbyist, in Indiana an energy lobbyist, a casino lobbyist in Nevada," said a Clinton commercial that aired in the final days of the race.
Obama responded with an ad that accused Clinton of "eleventh-hour smears paid for by lobbyist money." It said that unlike his rival, he "doesn't take money from special interest PACs or Washington lobbyists — not one dime."
To the delight of Republicans, the six-week layoff between primaries produced a string of troubles for the Democrats.
Obama was forced onto the defensive by incendiary comments by his pastor, Rev. Jeremiah Wright, then triggered controversy on his own by saying small-town Americans cling to guns and religion because of their economic hardships.
Clinton conceded that she had not landed under sniper fire in Bosnia while first lady, even though she said several times that she had. And she replaced her chief strategist, Mark Penn, after he met with officials of the Colombian government seeking passage of a free trade agreement that she opposes.
McCain, the Republican nomination already his, rose in the polls as he prepared for the fall campaign.
The remaining Democratic contests are primaries in North Carolina, Indiana, Oregon, Kentucky, West Virginia, Montana, South Dakota and Puerto Rico, and caucuses in Guam.
What's been going on in Hollywood?
~Jessica Simpson gave boyfriend (and Dallas Cowboys quarterback) Tony Romo a show at his 28th birthday party, where she licked cake off his face and sang 'Happy Birthday.' Dallas, TX
~Jennifer Lopez and Marc Anthony were seen leaving the Waverly Inn on April 14, 2008 in New York City.
~Christina Aguilera was photographed at VILLA in Los Angeles on April 13.
~Pete Wentz and Ashlee Simpson, wearing her engagement ring, sighted at the Ritz Carlton in New York City on April 16,2008.
~Zac Efron was photographed arriving from London, having a quick stop to JFK before heading to Salt Lake City on April 13, 2008.
~Gwen Stefani with son Kingston and her husband Gavin help cool down from a scorching day in Los Angeles by playing in the water and on the beach in Santa Monica on April 13.
~Britney Spears gets serious about exercising in LA on April 16, 2008.
~Carrie Underwood and 50 Cent behind the scenes at vitaminwater TV commercial shoot on April 7, 2008 at Ironbound Recreation Center in Newark, NJ.
~Paris Hilton and Benji Madden continue partying in London on April 15. The pair started off in Camden before heading to Crystal nightclub where Paris was reportedly payed $20,000 for an appearance.
~Hosts Miley Cyrus and Billy Ray Cyrus pose in the press room during the 2008 CMT Music Awards at the Curb Events Center at Belmont University on April 14, 2008 in Nashville, Tennessee.
~Lindsay Lohan was seen hiding at a bakery in Hollywood on April 15, 2008.
~The Jonas brothers arrived at LAX from London on April 14.
~Fergie and Josh Duhamel were out for dinner in NYC on April 15.
~ Amy Winehouse took a break from the recording studio where she was holed up to play with a friend's baby and take a shot of liquor in Northern England on April 14.
~Lindsay Lohan and her pal DJ Samantha Ronson grab a late lunch at trendy Joan's on Third on April 11. After the meal, they head off in Ronson's black Porsche.
~Keith Urban pats his wife, Nicole Kidman's stomach as they pose for photographers at the CMT Music Awards Monday, April 14, 2008, in Nashville, Tenn.
~Miley Cyrus and Brandi Cyrus attends the 2008 CMT Music Awards at the Curb Events Center at Belmont University on April 14, 2008 in Nashville, Tennessee.
~Taylor Swift and Snoop Dogg seen backstage during the 2008 CMT Awards at Curb Event Center at Belmont University on April 14, 2008 in Nashville, Tennessee.
~Carrie Underwood seen backstage during the 2008 CMT Music Awards at the Curb Events Center at Belmont University on April 14, 2008 in Nashville, Tennessee.
~Britney Spears driving again after car crash....but this time a toy car with son Sean Preston on April 14, 2008 in Beverly Hills.
~Paris Hilton promotes her line of hair extensions called DreamCatchers at the 41st Annual Cosmoprof, the Italian beauty and hair trade showon April 12, 2008 in Bologna, Italy.
~Newly engaged, and possibly pregnant Ashlee Simpson with her mother Tina arrived at JFK airport after a flight from Los Angeles on April 14.
~Pink jogs along the beach on a sultry Malibu day on April 12.
~American Idol judge and former singer/dancer Paula Abdul was literally swept off her feet at LAX airport on April 13after a male friend embraced her and lifted her up into the air much to Paula's amazement. Paula who was a little unsteady on her feet realised she had lost her earring and bent down to get it and was then helped to her feet to continue on to board her flight.
~Faith Hill and Tim McGraw onstage during the 2008 CMT Music Awards at the Curb Events Center at Belmont University on April 14, 2008 in Nashville, Tennessee.
~Gwyneth Paltrow leaving with Madonna after using her gym for the first time after a 2 hour workout on April 13. Madonna's bodyguard came out in the rain to give Gwyneth a personal escort to Madonna's other house which was next door in London.
~Victoria Beckham does some shopping at Kitson in Los Angeles and exits the store to a mass photo frenzy on April 15, 2008.