"Thank you, South Carolina!" Gingrich swiftly tweeted to his supporters. He appealed for a flood or donations for the next-up Jan. 31 primary. "Help me deliver the knockout punch in Florida. Join our Moneybomb and donate now," he tweeted.
Already, Romney and a group that supports him were on the air in Florida with a significant ad campaign, more than $7 million combined to date. Romney had hoped that Florida would seal his nomination -- if South Carolina didn't first -- but that strategy disappeared Saturday night.
Former Pennsylvania Sen. Rick Santorum and Texas Rep. Ron Paul trailed badly in the South Carolina voting.
Exit polling showed Gingrich, the former House speaker, leading by a wide margin among the state's heavy population of conservatives, tea party supporters and born-again Christians.
For the first time all year, Romney trailed among voters who said they cared most about picking a candidate who could defeat President Barack Obama this fall. Gingrich was ahead of the field for those voters' support.
There were 25 Republican National Convention delegates at stake, but political momentum was the real prize with the race to pick an opponent to President Barack Obama still in its early stages.
In all, more than $12 million was spent on television ads by the candidates and their allies in South Carolina, much of it on attacks designed to degrade the support of rivals.
Interviews with voters as they left polling places showed nearly half saying their top priority was finding a candidate who could defeat Obama in the fall, followed by wishes for experience, strong moral character and true conservatism.
In a state with 9.9 percent unemployment, concern about the economy was high, and almost one-third of those voting reported a household member had lost a job in the past three years.
The exit poll was conducted for The Associated Press and the television networks by Edison Research as voters left polls at 35 randomly selected sites. The survey involved interviews with 1,577 voters and had a margin of sampling error of plus or minus 4 percentage points.
Romney, the former Massachusetts governor, swept into South Carolina 11 days ago as the favorite after being pronounced the winner of the lead-off Iowa caucuses, then cruising to victory in New Hampshire's first-in-the-nation primary.
But in the sometimes-surreal week that followed, he was stripped of his Iowa triumph -- GOP officials there now say Santorum narrowly won -- while former Utah Gov. Jon Huntsman dropped out and endorsed Romney and Texas Gov. Rick Perry quit and backed Gingrich.
Romney responded awkwardly to questions about releasing his income tax returns, and about his investments in the Cayman Islands. Gingrich, the former speaker of the House, benefited from two well-received debate performances while grappling with allegations by an ex-wife that he had once asked her for an open marriage so he could keep his mistress.
By primary eve, Romney was speculating openly about a lengthy battle for the nomination rather than the quick knockout that had seemed within his grasp only days earlier.
One piece of primary day theater failed to materialize when the two men avoided crossing paths at Tommy's Ham House in Greenville, packed with partisans holding signs that read either "Romney" or "Newt 2012."
Romney rolled in earlier than expected, and had left by the time Gingrich arrived.
Santorum got a lift hours before the polls closed when the Iowa Republican Party declared him the winner of the caucuses on Jan. 3. Romney was pronounced the victor by eight votes initially, but on Thursday, party officials said a recount showed Santorum ahead by 34. Even so, they declared the outcome a tie.
Santorum, a former Pennsylvania senator, pinned his South Carolina hopes on a heavy turnout in parts of the state with large concentrations of social conservatives, the voters who carried him to his surprisingly strong showing in Iowa.
Paul had a modest campaign presence here after finishing third in Iowa and second in New Hampshire. His call to withdraw U.S. troops from around the world was a tough sell in a state dotted with military installations and home to many veterans.
As the first Southern primary, South Carolina has been a proving ground for Republican presidential hopefuls in recent years.
Since Ronald Reagan in 1980, every Republican contender who won the primary has gone on to capture the party's nomination.
Romney's stumbles began even before his New Hampshire primary victory, when he told one audience that he had worried earlier in his career about the possibility of being laid off.
He gave a somewhat rambling, noncommittal response in a debate in Myrtle Beach last Monday when asked if he would release his tax returns before the primary. The following day, he told reporters that because most of his earnings come from investments, he paid about 15 percent of his income in taxes, roughly half the rate paid by millions of middle-class wage-earners. A day later, aides confirmed that some of his millions are invested in the Cayman Islands, although they said he did not use the offshore accounts as a tax haven.
Asked again at a debate in North Charleston on Thursday about releasing his taxes, his answer was anything but succinct and the audience appeared to boo.
Gingrich benefited from a shift in strategy that recalled his approach when he briefly soared to the top of the polls in Iowa. At mid-week he began airing a television commercial that dropped all references to Romney and his other rivals, and contended that he was the only Republican who could defeat Obama.
It featured several seconds from the first debate in which the audience cheered as he accused Obama of having put more Americans on food stamps than any other president.
Nor did Gingrich flinch when ex-wife Marianne said in an interview on ABC that he had been unfaithful for years before their divorce in 1999, and asked him for an open marriage.
Asked about the accusation in the opening moments of the second debate of the week, he unleashed an attack on ABC and debate host CNN and accused the "liberal news media" of trying to help Obama by attacking Republicans. His ex-wife's account, he said, was untrue.
Associated Press writers Shannon McCaffrey, Kasie Hunt and Beth Fouhy contributed to this report.