Mark Drakeford is set to become Wales’ next first minister after he won the Welsh Labour leadership election.
The pro-Corbyn finance secretary, who secured 53.9% of the vote after the count went to a second round, pledged to make Wales “a beacon of hope in a darkening world”.
He is expected to replace Carwyn Jones at the helm of the Welsh Government when he stands down next week.
Vaughan Gething came second with 41.4% of the vote. Eluned Morgan was third.
Deputy Welsh Labour leader Carolyn Harris revealed the election result at the Cardiff Principality Stadium on Thursday, after a contest that lasted eight months.
The Carmarthen-born academic, 64, has pledged to extend the smoking ban to town and city centres, and give the parents of newborn babies a bundle of essential items.
Around 175,000 people had the right to vote – including around 25,000 party members and others who are part of affiliated trade unions.
Mr Jones announced in April he would step down by the end of 2018 – he has been in the job for nine years.
The Welsh Labour leader-elect said he would work to give Wales a “future which works for the many in our society and not simply for a privileged few”.
He paid tribute to the defeated candidates saying the “richness of ideas” they contributed in the campaign would make Welsh Labour “a stronger party with a greater reservoir of commitment and strength”.
Mr Drakeford said the ultimate aim was to have “a Labour government in Westminster working with a Labour government in Wales”.
“Our most radical and successful days lie ahead of us”, he added.
Labour party leader Jeremy Corbyn, who Mr Drakeford had supported during UK leadership elections, said he is confident “Mark will demonstrate what Labour in government can achieve by building a more equal society, even in the face of the Conservatives’ callous austerity agenda”.
“I know Mark will relentlessly fight for the interests of the Welsh people and stand up to the Tories’ chronic underinvestment in Wales compared to other parts of the UK, particularly London,” he added.
Mr Jones will tender his resignation to the Queen next Tuesday.
His last year has been dominated by events following the death of Carl Sargeant, who was found dead in November 2017 days after Mr Jones sacked him from his cabinet.
Before the result Mr Jones told the crowd that it had been the “greatest honour of my life” to be first minister.
He said Welsh Labour “will never stop until we see more justice, more fairness, more opportunity and more equality”.
By Felicity Evans, BBC Wales political editor
Mark Drakeford was always the front runner, but this result is closer than many people expected. He had the bulk of the support from Labour’s big institutions, including Momentum – which has swelled the ranks of Welsh Labour members in the last couple of years.
It will be interesting to see the turnout figures – perhaps many Momentum members are focused exclusively on Westminster and haven’t engaged with this campaign. Or perhaps they chose not to follow the organisation’s endorsement.
Either way this result is not the resounding victory many predicted. One senior Labour figure and Drakeford supporter whispered to me: “That was close”.
Another said: “A win’s a win”.
“Who can remember what Carwyn’s margin of victory was 9 years ago?”
Voters in the election could vote for a first and second preference candidate. In the first round, Mark Drakeford won 46.9% of the vote, versus 30.8% for Vaughan Gething and 22.3% Eluned Morgan.
After Eluned Morgan came third in the first round, the second preference votes of those who supported her were redistributed.
As a result, Mark Drakeford got 53.9% while Vaughan Gething received 41.4%.
What happens next?
- Carwyn Jones resigns next Tuesday by emailing the Queen
- The resignation takes effect when she replies, also via email
- The assembly will seek nominations for first minister the following Wednesday
- AMs will back their preference in a roll-call vote, with the Welsh Government majority set to install Mark Drakeford
Under the rules of the assembly Mr Drakeford must be confirmed by the Welsh Assembly.
This is expected to take place last week – although Plaid Cymru and Welsh Conservatives are nominating their own leaders Adam Price and Paul Davies for the role.
It will be a major shock if either of those bids are successful, with the Labour government holding a majority in the Senedd.
Secretary of State for Wales, Tory MP Alun Cairns, welcomed the new first minister, saying he looked forward to working closely with him “to secure a stronger economy in communities right across Wales”.
Leader of the Welsh Conservatives in Cardiff Bay, Paul Davies, gave qualified congratulations, saying Mr Drakeford “has a huge task ahead of him in solving the problems our nation is experiencing after decades of failure from successive Labour-led governments”.
“While Mark Drakeford has a mandate to lead from the Labour Party, he has no mandate to lead from the Welsh people; only a Welsh Assembly election will provide an opportunity for the public to endorse, or otherwise, his plans,” he added.
A Plaid Cymru spokeswoman said the “mountain of issues” Mr Drakeford faces “is great and it is a mountain largely of his own making”.
“He was part of a Labour administration that has left us with an economy that still bounces across the bottom of league tables and public services crying out for help.”