Texas Senator Ted Cruz has won the Iowa Republican caucuses, the first vote to choose US presidential candidates.
“Tonight is a victory for courageous conservatives,” he declared, to great applause, as he railed against Washington, lobbyists and the media.
He took 28% of the Republican vote, beating his rival, the frontrunner Donald Trump, and Marco Rubio.
Votes in the Democratic race are still being counted, with Hillary Clinton’s camp saying they have narrowly won.
The aim of the primary and caucus races in the coming months is to determine which candidates will stand for the two main parties in the November presidential election.
Iowa caucus results
Republican vote, 99% reported:
Ted Cruz: 28%, eight delegates
Donald Trump: 24%, seven delegates
Marco Rubio: 23%, seven delegates
Ben Carson: 9%, three delegates
Rand Paul, Jeb Bush: one delegate each. Chris Christie, Carly Fiorina, Jim Gilmore, Mike Huckabee, John Kasich and Rick Santorum: no delegates
Democratic vote, 99% reported:
Hillary Clinton: 50%, 22 delegates
Bernie Sanders 50%, 21 delegates
Martin O’Malley, 1%, no delegates
Her campaign director in Iowa, Matt Paul, said there was “no uncertainty” that the former secretary of state and first lady had beaten Bernie Sanders, a 74-year-old senator from Vermont.
In five precincts the vote was decided by the toss of a coin – all going to Mrs Clinton, according to the Des Moines Register.
Iowa’s Democratic Party said with one precinct still to be called there results were “the closest in Iowa Democratic caucus history”.
Mr Sanders said it was a “virtual tie” and before leaving for New Hampshire, which is holding party primaries on Tuesday, Mrs Clinton told her supporters she was “breathing a sigh of relief”.
There was no such ambiguity from Republican victor Mr Cruz, the 45-year-old conservative, who is disliked by the Republican Party leadership.
“Iowa has sent notice that the Republican nominee and the next president of the United States will not be chosen by the media, will not be chosen by the Washington establishment,” he said.
In the end it was a victory for organisation over enthusiasm. Despite trailing Donald Trump in the polls for much of the last two weeks, Ted Cruz swept to a comfortable win in Iowa.
During his victory speech, he repeatedly thanked his grass-roots support – and for good reason. He and his campaign had invested considerable time and money to grind out a victory in this key state, and they were ultimately rewarded for their efforts.
With this result Mr Cruz now has the momentum to survive what looks to be an uphill battle among the more moderate voters in New Hampshire, and then win over the deeply conservative, evangelical voters of Southern states that dominate the primary calendar in the following weeks.
It appears increasingly likely that a showdown for Mr Cruz looms on the horizon with the surprise third-place finisher in Iowa, Senator Marco Rubio. And Mr Trump – even if his supporters did not turn out in the numbers expected – will surely remain a factor.
Mr Trump congratulated the Texas senator and said he was “honoured” by the second-place finish.
Mr Rubio, who has struggled to gain support in recent months, has performed far better than expected, and finished just one percentage point behind Mr Trump.
Meanwhile, two candidates are bowing out.
Sources close to Democrat Martin O’Malley, former Maryland governor, have told the BBC that he will suspend his campaign – narrowing the field to two competitive candidates.
On the Republican side, Former Arkansas Governor Mike Huckabee tweeted that he too would suspend his campaign.
Iowa has an unusual election system based on caucuses, which involve people gathering at private homes, schools and other public buildings across the state.
Democratic voters divide themselves into groups based on their preferred candidate, but the Republican caucus process is more like a traditional ballot.