The Democrats' hopes of winning control of the US Senate have been dealt a blow in the mid-term elections.

A Donald Trump Republican ally is projected to unseat an incumbent in Indiana, but Democratic senators held on in West Virginia and New Jersey.

Democrats also scored significant gains in the House of Representatives, and two US networks predict they will take control of the chamber.

Republicans currently control both legislative chambers.

President Trump is not up for re-election until 2020, but Tuesday's poll will shape his agenda for the remainder of his two years in office.

What's happening in Senate races?

Republicans look likely now to retain control of the Senate - they currently have a slim 51-49 majority, but only nine of the party's seats were up for grabs, while Democrats were defending 26 seats.

Republican businessman Mike Braun was projected to oust first-term incumbent Joe Donnelly, a moderate Democrat in Indiana.

White House press secretary Sarah Sanders said Mr Trump had "closed the deal" for Mr Braun after holding a rally in the state on Monday night.

Media playback is unsupported on your device Media caption Senator Bernie Sanders of Vermont: 'President is a pathological liar'

Republican Marsha Blackburn won a Senate seat in Tennessee against Democrat Phil Bredesen, who was endorsed by pop star Taylor Swift.

There was some consolation for Democrats as Senators Joe Manchin and Bob Menendez held on to their seats after tough campaigns in West Virginia and New Jersey respectively.

Mr Manchin was the only member of his party to vote to confirm Supreme Court Justice Brett Kavanaugh, whose nomination narrowly survived sexual assault claims.

A cliff-hanging vote count in Florida has Republican Rick Scott neck and neck with incumbent Democratic senator Bill Nelson.

Republican Ted Cruz Cruz has a slight lead against his challenger, Democratic rising star Beto O'Rourke.

Mitt Romney, the 2012 Republican presidential nominee, has won election to US Senate from Utah, as expected.

What's happening in House races?

Two US networks - Fox and NBC - are projecting that the Democrats are expected to win the 23 seats they need to take over the House of Representatives.

Americans voted for all 435 seats in the House.

In suburban Virginia, Democrat Jennifer Wexton ousted incumbent Republican Barbara Comstock, while another Democrat, Donna Shalala, flipped a Florida constituency against Republican Maria Salazar, a news anchor.

New York Democrat Alexandria Ocasio-Cortez is projected to have become the youngest woman ever elected to the US House at 29 years old.

If Democrats do win the House, they are expected to launch investigations into Mr Trump's administration and business affairs, from tax returns to potential conflicts of interest, while thwarting his legislative agenda.

What you need to know about mid-terms:

What's happening in governors' races?

Governors are also being chosen in 36 out of 50 states.

The Sunshine State's governor race is too close to call between a left-wing progressive, Andrew Gillum, and a Trumpist conservative, Ron DeSantis.

Democratic candidate Stacey Abrams could become the first female African-American governor in the US. Her Republican opponent Brian Kemp's office has been accused of voter suppression.

To add to polling day tensions, broken voting machines led to longer queues and a return to paper ballots in some parts of the state.

Media playback is unsupported on your device Media caption Hang on, what ARE the US 'mid-terms'?

Senate door closing on Democrats

Analysis by Anthony Zurcher, BBC News

Democrats always faced an uphill fight in the Senate, with 10 incumbents running in states that Donald Trump carried in 2016. Even though the president won Indiana by 16%, Joe Donnelly was supposed to be one of the endangered candidates with a better chance to hold on.

Instead, he was the first to fall.

Mr Trump barnstormed the critical Senate battleground states in the final days of the campaign, effectively making the contests as much about him as they were about the individual candidates. It appears to have been an effective strategy in places like Indiana and Tennessee.

In West Virginia, however, Joe Manchin continued to defy political gravity by holding on to his seat. And in other previously Trump-friendly 2016 states - Wisconsin, Ohio and Pennsylvania - Democratic incumbents breezed to victory. In all it makes for a muddled picture that as much reflects regional identities, demographic differences and specific candidate strengths as it does Mr Trump's political power.

It also, however, nearly closes the door on Democratic hopes to retake the Senate. In a best-case scenario, a political tailwind would push all the at-risk candidates across the finish line. Instead, some survive while others falter.

How has voting unfolded?

After months of campaigning and billions of dollars in spending on adverts, leaflets and bumper stickers, voters came out in force.

Around 40 million people cast early ballots according to the US Elections Project, a University of Florida-based information source. That figure in 2014 was just 27.5 million.

In Texas, early voting exceeded the entire turnout in 2014.

Some states showed signs of being overwhelmed by the voter influx, however.

There were reports of electronic voting machine failures and congested polling stations - including in Georgia, Atlanta, Arizona, and New York.

Relief at social networks as defences hold

A Homeland Security official said the department had received "sparse" reports of tech failure, but that there seemed to have been no significant impact on people's ability to vote.

Media playback is unsupported on your device Media caption Can liberal Beto O'Rourke end the Democratic drought in conservative Texas?