Labour is set to retain control of the Welsh government after the party fought off challenges from the Conservatives to key "red wall" seats.
With the final results still to come, Labour has exactly half the 60 seats in the Senedd, equalling its best-ever results.
Results so far have seen Labour win 30, the Tories 12, Plaid Cymru nine and the Liberal Democrats one.
Only one of Wales’ red wall seats – the Vale of Clwyd – fell to the Tories.
Wrexham, Clwyd South and Delyn, were all held despite being targeted by the Conservatives after they flipped them from Labour in the 2019 general election.
Polling at the start of the campaign suggested Labour was facing its worst-ever result and was at risk of winning as few as 22 seats, a loss of seven from 2016, though later polls suggested a stronger showing.
After voting closed at 10pm on Thursday, Labour sources said retaining all of its seats in the Senedd remained "a massive challenge".
Labour First Minister Mark Drakeford, who extended his majority for his Cardiff West seat by more than 10,000 votes, said he was delighted his party had "exceeded expectations".
"Did I think we would be up approaching the top of the twenties? That was probably at the top end of what I thought was achievable, given the extraordinary circumstances of this election," he said.
Mr Drakeford said he will wait until all election results are in today before he thinks about forming a new government.
"I will want to sit down tomorrow [Saturday] when we have a full suite of results in front of us to think about how we can achieve what we need here in Wales, which is a stable and progressive government."
Commenting on the surprise turnaround, a Labour spokesperson said: "It is increasingly clear that people across Wales have put their faith in Welsh Labour and Mark Drakeford to lead the next Welsh government and lead Wales out of the pandemic."
Health minister Vaughan Gething, who held his Cardiff South and Penarth seat with 18,153 votes (49.89%), said Labour and Mr Drakeford’s handling of the pandemic was a "major factor" in the party’s results.
"We’ve had to make life-changing choices that affected every single family in the country," he said.
"The pandemic has thrust the first minister in the spotlight, and most people like what they’ve seen in the way he’s handled the pandemic.
"What we now need to do is understand what that means for the future government for Wales, how we handle this next phase finishing up the pandemic response, and then the difficult task of recovery – one that I think we’re in the best possible place for."
Conservative leader in the Senedd Andrew RT Davies said his party’s taking of Vale of Clwyd from Labour was a "brilliant result", but suggested traditional Labour voters who voted Tory in the 2019 general election had now "come home".
"It does seem from other seats that have been declared in other parts of Wales that the Labour voters have come home to it after the, shall we say, Brexit election of 2019," he said.
Welsh Labour’s uninterrupted dominance looks set to continue
Analysis by Dan Whitehead, home news correspondent
Labour started count day briefing journalists about the "massive challenge" it faced if it were to retain its current seats in the Senedd – the day ended with the party matching its largest ever victory.
Fears Labour losses in England would spread across the red wall in the north of Wales were unfounded – with Wrexham, Alyn and Deeside and Clwyd South all staying with Labour.
The talk of Welsh Conservative Senedd gains to match 2019 general election results just didn’t materialise.
Nor did Plaid Cymru’s promise to "make history" – an independence referendum was clearly not a priority for the Welsh, with leader Adam Price insisting he has no plans to resign despite disappointing results.
Another notable win for Labour was regaining control of the Rhondda from former Plaid leader Leanne Wood.
In the end Labour increased its vote share on constituency seats to 39.9% – a result it simply wasn’t predicting at the start of the day.
It wasn’t all good news for the party – it lost the Vale of Clwyd for the first time, but the Conservative win was small.
The backdrop of Wales’ election result was the COVID-19 pandemic.
It put devolution in the spotlight like nothing before, with voters clearly deciding that First Minister Mark Drakeford has guided the country well through a tough 14 months.
With some final regional seats still to declare, it’ll be a while before we know the exact make-up of the new Welsh parliament.
One thing is for sure – Labour’s uninterrupted dominance in Wales looks set to continue – 22 years on from devolution.