Texas Senator Ted Cruz has won the Iowa Republican caucuses, the first vote of the US 2016 presidential election.

"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 once frontrunner Donald Trump, and Marco Rubio.

Votes in the Democratic race are still being counted, and some US media have declared it a dead heat.

With 95% of results confirmed, Hillary Clinton clung to the narrowest of leads over Bernie Sanders and told supporters she was "breathing a sigh of relief".

The former secretary of state and first lady stopped short of declaring victory, and her rival, a 74-year-old senator from Vermont, said it was a "virtual tie".

As country music blared across the loud speaker at his Des Moines rally, the 45-year-old conservative, who has been a thorn in the side of his party, relished his victory.

"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," said Mr Cruz.

"Tonight is a victory for courageous conservatives across Iowa and all across this great nation."

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 in third place – just one percentage point behind Mr Trump.

US election: Trump dealt blow by Cruz in Iowa vote

US election: Trump dealt blow by Cruz in Iowa vote

Marco Rubio gave a speech that was like a victory rally

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.

Over the coming months, the other 49 states as well as US territories will vote for the party nominees.

Each states' delegates will be tallied and a nominee will become apparent towards the middle of the year.

In November, the US will pick who its next president will be. He or she will assume office in January 2017.