Joe Biden has been elected president of the United States, after his projected victory in Pennsylvania took him over the winning line.
With all states now projected, President-elect Biden has 306 electoral college votes and Donald Trump has 232. A candidate needs 270 or more to win.
Mr Biden will become the 46th president in January, pending the outcome of any legal challenges.
There is still a recount to come in Georgia, but Mr Biden has a lead of almost 15,000 votes and the 16 electoral college votes are not enough to overturn his overall victory.
Mr Biden's running mate, Kamala Harris, will make history as the first woman vice-president, as well as the first black and the first Asian American vice-president.
Click or tap on the map below to get detailed results.
The winds of change
This map shows where either the Republicans (red arrows) or Democrats (blue arrows) have performed better than in 2016.
It is far from a consistent picture, with both parties gaining in some areas and losing support in others.
How Biden won Pennsylvania
With nearly all of the votes in Pennsylvania counted, Mr Biden has been projected to overturn Mr Trump's narrow 2016 win with a narrow win of his own.
A strengthening of support in some areas where the Democrats also did well in 2016 - particularly around Philadelphia in the south east corner - has been enough to generate this result.
The first three had been Democrat strongholds for decades before favouring Mr Trump over Hillary Clinton four years ago.
Arizona has not been won by a Democrat since Bill Clinton's second term 24 years ago, and Georgia not since Mr Clinton's first win in 1992.
The results in context
In the US electoral system, the results in each state have a widely varying impact on the final result, with states that have larger populations given more say than those with smaller populations.
The map below represents each state and the District of Columbia as a square, with its area corresponding to the number of votes its representatives will cast in the electoral college that ultimately decides whether Mr Biden or Mr Trump has won the presidency.
It shows that both the Republicans and the Democrats have won their share of larger and smaller states, but Mr Biden has now picked up states worth more than the 270 he needed to win the presidency.
The key battlegrounds
But the wins in Arizona, Georgia, Michigan, Wisconsin and Pennsylvania - worth 73 electoral college votes altogether - have been enough for Mr Biden to win the presidency.
Preliminary figures show the highest turnout since 1900, with 66.4% of eligible voters turning out compared with 60.1% in 2016.
As Mr Biden also leads the national popular vote on 50.8% to Mr Trump's 47.4% - a lead of over five million votes - this boost in participation means that the president-elect has already received more votes than any candidate in US electoral history - close to 78 million so far, with the count continuing in some states.
Mr Trump has also increased his vote tally compared with 2016 by more than 9 million votes, to over 72 million this year. Despite being projected to lose the election, this figure gives him the second-highest number of votes of any US presidential candidate.
How Trump kept hold of Florida
Mr Trump has been projected to win the closely-fought state of Florida, with 51% of the vote compared with Mr Biden's 48%.
Despite taking what is typically a bellwether state, Mr Trump failed to win a second term in the White House.
Exit poll estimates put Mr Trump on a 61% share of the white vote in Florida.
Mr Biden appears to have made up ground on Hillary Clinton's performance with this demographic in 2016.
However, Mr Trump is also estimated to have gained 12 points among Latino voters, bringing him nearly level with Mr Biden.
How the results stacked up
Here's how the map coloured up, from the first states to be projected on election night, to Pennsylvania on Saturday.
Race for Congress
Although the Democrats have made a net gain of one seat in the race for the Senate, the Republicans remain ahead, on 50 seats to the Democrats' 48.
Both of the Georgia senate races have gone to a run-off after no candidate secured more than 50% of the votes.
There will now be another vote, on 5 January 2021, to separate the two top candidates in each race and determine which party controls the legislature's upper chamber.
In the House, despite losing five seats the Democrats have now crossed the winning line of 218 and will retain their majority.
There are still 13 seats to declare so the exact size of the majority is still to be determined.
Key details from the exit poll
Exit poll data from across the United States gives a glimpse into voters' priorities and an indication of how different demographic groups cast their ballots.
The figures suggest the proportion of total voters who are white has fallen by six percentage points on 2016, while remaining the largest group by ethnicity.
The proportion of white voters backing Mr Biden has risen by five points on Hillary Clinton's figure at the last election, but Mr Trump still takes the largest share of this group, the preliminary polling suggests.
Meanwhile, Mr Biden appears to have gained support among under 30s and the middle-aged.
The exit polls are carried out across the US by Edison Research and are a combination of election day interviews and telephone polling, designed to reach early and absentee voters.
What voters thought about the key issues
Nationally, more than a third of voters said the economy was the most important issue in deciding who to choose as president, with a further 20% naming racial inequality and 17% saying the coronavirus pandemic.
However the issues were split along partisan lines with more than four times as many Trump voters saying the economy was the deciding factor, and Biden voters answering racial inequality and the virus.
Voters were evenly split on how the US economy was faring, with 48% saying it was in "excellent or good" condition and 50% saying it was "not so good or poor".
Similarly, 50% said that the US was doing "somewhat or very badly" at containing the pandemic and 48% thought the country was doing "somewhat or very well".
The possibility of voter fraud has been raised repeatedly by the Trump campaign but a large majority of voters (87%) told the researchers they were confident that votes in their state would be counted accurately.
The exit polls are made up of a national exit poll and 22 state exit polls which are carried out by Edison Research for the National Election Pool (ABC, CBS, CNN, NBC).
For the national poll, a total of 15,590 voters who cast ballots on Election Day were interviewed at 115 polling places as they exited the polling places. This survey also includes 4,919 absentee and/or early voters interviewed by telephone.
The data is then weighted to be representative of the population and are adjusted further as votes are counted.
All samples are approximations and are subject to a margin of error which will be wider for small sub-groups such as smaller ethnic groups.
By Daniel Dunford, Christine Jeavans, John Walton, Ed Lowther, William Dahlgreen and Irene de la Torre Arenas