Senator John McCain edged out former Arkansas governor Mike Huckabee on Saturday in a hard-fought Republican primary in South Carolina.

With more than 90 per cent of the results in, McCain was taking 33 per cent of the support while Huckabee had 30 per cent. Former Massachusetts governor Mitt Romney and former Tennessee senator Fred Thompson were in a close fight for third place, each with about 15 per cent of the vote.

McCain said his victory in South Carolina is evidence that his campaign "can carry right through" Florida into the giant round of caucuses and primaries on Feb. 5.

"I know it's not easy," he told the Associated Press, "and we've got a long way to go."

"I'm very confident that we'll win in Florida," he added.

Asked if he was now the front-runner for the GOP nomination, McCain demurred. "I don't know," he said. "We like to run from behind."

Huckabee had been hoping to rebound from a string of disappointing showings since his surprise victory in the Jan. 3 Iowa caucuses, in a bid to prove he's not a one-state wonder who holds no appeal beyond his born-again Christian base.

Even with the loss, Huckabee vowed to carry on.

"Well, obviously we wanted to come here and declare a South Carolina victory," he told supporters. "We got awful close."

"The reason I want to encourage you tonight is to remind you that politics — and particularly this year, perhaps more so than any other — this is not an event. It is a process," Huckabee said. "And the process is far, far from over."

The outcome raised questions about the future of Thompson's campaign. Before the results began coming in, Thompson said he needed a strong showing to sustain his candidacy.

The Democratic primary in South Carolina is set for Jan. 26.

With files from the Associated Press