DES MOINES, Iowa—Mitt Romney pulled out a razor-thin victory by just eight votes in the Iowa caucuses, edging out Rick Santorum and opening the Republican primary season with a dose of momentum going into a New Hampshire primary he is heavily favored to win.

Mr. Santorum's performance was in some ways more remarkable, as the former Pennsylvania senator vaulted to the top just weeks after he had been little more than a footnote in the race. By effectively tying Mr. Romney, he made at least a tentative case for himself as the conservative alternative to the front-running former Massachusetts governor. Still, many Republicans don't believe Mr. Santorum has the resources for a drawn-out campaign.

Texas Rep. Ron Paul put together a strong third-place finish, assembling an unusual coalition that relied in part on an influx of independents into the GOP race.

The final count showed Messrs. Santorum and Romney both receiving about 25% of the vote, with Mr. Romney garnering just eight more votes than Mr. Santorum, and Mr. Paul coming in at 21%. The lead seesawed between the two front-runners into early Wednesday, making it impossible for the race to be called until 2:34 a.m.

Mr. Romney received 30,015 votes to 30,007 for Mr. Santorum, said Matthew Strawn, chairman of the Iowa Republican Party. Mr. Strawn said 122,255 votes were recorded in the caucuses.