What a difference a week makes.

Newt Gingrich completed his miraculous come-from-behind charge Saturday, surging to a commanding victory over a wounded Mitt Romney to win the South Carolina Republican presidential primary.

“The biggest thing I take from the campaign in South Carolina is that it’s very humbling and very sobering to have so many people who so deeply want their country to get back on the right track,” Gingrich told a crowd of cheering supporters in Columbia.

Gingrich won 40 percent of the vote while Romney had 28 percent, according to unofficial results.

The victory gives Gingrich 15 of the state’s delegates, with 10 still to be awarded, and propels him into Florida, where many more delegates are up for grabs. Romney has built a strong base there and has spent millions of dollars running advertisements.

Gingrich’s victory moves him closer to becoming the conservative alternative to Romney that some social conservatives and tea party activists have been seeking.

Romney arrived in South Carolina in an enviable position after his win in New Hampshire, while Gingrich was scraping along with poor showings there and in Iowa.

But Gingrich’s dominating performance in the two debates last week — in North Charleston and Myrtle Beach — and the withdrawal of Rick Perry and Jon Huntsman from the race helped him gain momentum and turn the tables on Romney, the former front-runner.

With so many voters still trying to make up their minds last week, the debates helped turn many of those undecided people into Gingrich supporters. Despite late attacks on his personal life, Gingrich turned the tables on his opponents and the media, garnering the crucial support of undecided voters.

South Carolina voters, in general, also are more conservative than those in Iowa and New Hampshire, which helped Gingrich.

Romney entered the state with victories in Iowa and New Hampshire and was leading in the polls in South Carolina until the debates. Then the final tally in Iowa last week gave the victory there to Rick Santorum.

Gingrich’s first win of the 2012 primary season gives him momentum heading into the next showdown, the Jan. 31 primary in Florida.

Santorum placed third while Ron Paul came in fourth, according unofficial results.

The immediate takeaway from Saturday’s vote is that the GOP race is still a contest.

While many experts figure that Romney remains the favorite, Gingrich, a former history professor, has this history on his side: The winner of South Carolina’s primary has gone on to capture the GOP nomination in every contest since 1980.

Gingrich praised his three opponents and focused his criticism on President Barack Obama, who Gingrich said is “so weak that he makes Jimmy Carter look strong.”

Gingrich blasted “media elites” Saturday for “trying for a half century to force us to quit being American and force us to become some kind of other system.”

“People completely misunderstand what’s going on,” Gingrich said. “It is that I articulate the deepest-felt values of the American people.”

Gingrich also made the only South Carolina-specific references of all the candidates, saying he would push for offshore energy development and use the proceeds to modernize the Port of Charleston, which is responsible for one in five jobs in the state.

South Carolina remained tough territory for Romney, who placed fourth here four years ago and ended his campaign a few weeks later.

Romney also had endorsements from Gov. Nikki Haley and most of its largest newspapers. Still, he’s leaving here 1-2 in the first three GOP voting states.

Romney delivered his concession speech just before 8 p.m., well before the results were tallied but long after many media outlets had called the race.

His supporters roared as he took the podium, and Romney joked, “You should hear them when we win.”

He said he called to congratulate Gingrich and vowed to fight on. “In the coming weeks and months I’ll keep fighting for every single vote. I will compete in every single state,” he said.

“We’re going to win this nomination and we’re going to defeat President Obama in November. Our campaign will be about the businesses I helped start, not the bills I tried to pass. ... I don’t shrink from competition. I embrace it.”

Haley vowed to continue to campaign for Romney as the race moves on to other states, provided that she can work it into her schedule.

Romney remained the main target of Democrats Saturday night, just like he has since the campaign moved to South Carolina.

Democratic National Chairwoman Debbie Wasserman Schultz released a statement ignoring Gingrich but noting that Romney’s campaign has faltered. “Mitt Romney’s been exposed as being out of touch with the middle class,” she said, “and voters are seeing that he lives by another set of rules.”

Santorum, who made more campaign visits to South Carolina than any other candidate, had emphasized his record fighting against abortion and for traditional marriage. He hoped to win over the state’s evangelical Republicans, who can be a formidable voting bloc.

But in a contest where the dominant issues were about jobs — especially in a state with unemployment near 10 percent — and who was best positioned to beat Obama this fall, social issues appeared to take a back seat.

Conceding the results, Santorum delivered his final South Carolina remarks to an auditorium at The Citadel, where he noted his Iowa win and declared the nomination race still up for grabs.

“Three states, three winners,” he said to cheers. “What a great country.”

He stuck to his theme of representing working families in America whom he said have been left behind by Washington and the politics of both the major parties.

Paul, whose supporters remained among the most vocal and active in the race, proved that support for his Libertarian-blend of Republicanism is on the rise here.

Paul received only 3.6 percent of the vote four years ago; on Saturday he roughly tripled those numbers.

“There’s every reason to be encouraged,” Paul said.