With 97 percent of precincts reporting, McCain had 33 percent of the vote, compared to 30 percent for former Arkansas Gov. Mike Huckabee and 16 percent for former Tennessee Sen. Fred Thompson, CNN reported.
In claiming victory, McCain noted that the winner of the South Carolina usually goes on to win the GOP nomination, and joked about his loss to George W. Bush in the state in 2000.
"What's eight years among friends?" he said.
In a concession speech, Huckabee promised to remain competitive as the primary season progresses.
"This is not an event, it is a process," he said, "and the process is far, far from over."
Voting was affected by rain and snow in parts of the sate, and CNN reported that voting machines failed in all of the nearly 100 precincts in Horry County, which contains Myrtle Beach. Poll workers handed out paper ballots instead -- and at least one precinct ran out of the back-up ballots.
Campus cop fatally shoots Texas student during traffic stop
Reindeer recovered after escaping from Santa during lighting ceremony