If nothing else, the fact that just over half of South Carolina voters said in exit polls that they made up their minds at the last minute shows just how fluid and restive the Republican electorate remains — a troubling sign for Mr. Romney that Mr. Gingrich is now poised to capitalize upon.

And after being so confident just 10 days ago, the Romney campaign is now fighting not only the perception that Mr. Romney cannot consolidate broad support among conservative voters, but also at least one troubling fact: No Republican has gone on to win the party’s nomination without winning South Carolina since before 1980.

Exit polls showed two key factors in Mr. Romney’s loss: religion and viability. Pluralities of voters who said their priorities were Mr. Obama’s defeat in the fall or a nominee who shares their religious beliefs supported Mr. Gingrich, a Roman Catholic, over Mr. Romney, a Mormon. Over all, two-thirds of voters on Saturday considered themselves “conservative,” and 4 in 10 called themselves “very conservative,” larger percentages than did so in the New Hampshire primary.

Mr. Gingrich, according to exit polls, even beat Mr. Romney among groups that were believed to be solidly with Mr. Romney, chief among them women, debunking pre-primary day prognostications that news of his past marital problems would alienate female voters.

Speaking outside a polling station at the Hazel V. Parker Playground here in Charleston, Lynn Land, 61, said she decided to vote for Mr. Gingrich “at the very last second,” complimenting him for showing an ability to think on his feet at the debates. “He is a seasoned politician and will be able to debate Obama on an even level,” Mrs. Land said.