John McCain won the South Carolina primary for his second victory in the Republican nomination race and a boost to his candidacy going into the Jan. 29 contest in Florida.
Mike Huckabee placed a close second, Fred Thompson third and Mitt Romney fourth.
The win solidifies McCain's status as a front-runner and shows the U.S. senator from Arizona can appeal to the Republican Party's core voters in the South.
The results are a setback for Thompson, a former U.S. senator from Tennessee. He was banking on a victory in the state to show he could compete at the front of the pack.
"There are some tough contests ahead, and starting tomorrow in the state of Florida, where we're going to win," McCain told supporters in Charleston, S.C. "We are well on our way tonight. And I feel very good."
McCain had 33 percent of the vote, Huckabee had 30 percent and Thompson 16 percent, according to an Associated Press count with more than 90 percent of precincts reporting.
Romney, the former Massachusetts governor, scored his third win of the nomination race in Nevada's Republican caucuses. He earned 15 percent of the vote in South Carolina, according to the AP tally.
Huckabee, 52, a former Arkansas governor, conceded the contest and thanked McCain "for running a civil and good and a decent campaign." He said the closeness of the vote shows the nomination race is "far, far from over."
McCain's South Carolina win "is a major step forward toward the nomination," Craig Shirley, a Republican consultant in Alexandria, Va., said. "It erases his loss in Michigan and focuses new attention on him as the frontrunner."
In the past 28 years, South Carolina has picked the eventual winner of the Republican nomination, according to party chairman Katon Dawson. McCain's 2000 bid for the Republican nomination was derailed in the state, which he lost to then-Texas Gov. George W. Bush.
McCain revived his campaign, which had been beset by lagging fundraising and poll numbers just a few months ago, by winning in New Hampshire on Jan. 8. He suffered a setback with his second- place showing to Romney in the Michigan primary Jan. 15.
Romney, who is trying to appeal to the conservative base of the party, shifted money from South Carolina as polls showed McCain and Huckabee fighting for the lead.
Still, Romney leads in the race for delegates who select the Republican nominee, with wins in Wyoming, Michigan and Nevada and second-place finishes in Iowa and New Hampshire, according to a tally compiled by CNN.
McCain, 71, now emerges as a front-runner in Florida and the Feb. 5 so-called Super Tuesday contests in more than 20 states. Former New York Mayor Rudy Giuliani, 63,who has yet to win in a primary or caucus, is counting on Florida to give him his first victory.
Giuliani now "really needs to win Florida to demonstrate he remains a serious and credible contender," said Whit Ayres, a Republican pollster not aligned with any candidate.
For McCain, the strong showing in South Carolina "provides a measure of sweet justice," after his loss in 2000, Ayres said. That year, he was the target of a rumor campaign that sought to turn the state's Republicans against him.
Soon after McCain declared victory, his campaign sent an e- mail seeking donations for Florida and later contests. "Now that John McCain has won both the New Hampshire and South Carolina primaries, he has passed the historical test for Republican candidates and is on course to win," it said.
McCain's showing in South Carolina "is a huge springboard for him," said Tony Fabrizio, a Republican pollster who isn't aligned with any campaign. Placing second "certainly keeps Huckabee alive, particularly in Florida," he said.
Failing to place in the top two in South Carolina means Thompson, 65, isn't likely to get traction elsewhere, Fabrizio said. "He might as well go back to living the easy life," he said of the former actor.
Representative Duncan Hunter, a California lawmaker, dropped out of the presidential race. He took less than one percent of the vote in South Carolina. "Today, we end this campaign," Hunter said in a statement on his Web site.Florida is a winner-take-all primary with 57 delegates. The Real Clear Politics average of the latest polls for Florida shows McCain leading with 23 percent of support, followed by Giuliani with 20 percent. Romney is third with 18 percent.
Contributing: Ed Chen in Columbia, S.C.