Mark Drakeford is set to become Wales' next first minister after winning 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.
Carmarthen-born academic Mr Drakeford, 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.
Once confirmed, Mr Drakeford will take the helm of the Welsh Government, which has responsibility for health, education, transport and some taxation.
As well as dealing with the Welsh response to Brexit, Mr Drakeford will be faced with whether to reshuffle his ministers, and whether to go ahead with building the M4 relief road south of Newport.
By Felicity Evans, BBC Wales political editor
Mark Drakeford is the ultimate government insider - an adviser to the late former first minister Rhodri Morgan before succeeding him as the AM for Cardiff West and holding a variety of senior positions at cabinet level.
But while he is well known in political circles, many voters have never heard of him. This will be a challenge for him.
He 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.
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 nine years ago?"
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 told BBC Wales the party was going through a "healing process" after a turbulent twelve months following the death of Carl Sargeant.
The former communities minister was found dead in November 2017 days after Mr Jones sacked him from his cabinet.
'Richness of ideas'
Mr Drakeford said: "The [leadership] election is part of that healing process."
He said he would work to give Wales a "future which works for the many in our society and not simply for a privileged few".
In his acceptance speech 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.
Obviously I’m disappointed not to win the @WelshLabour leadership but I am incredibly grateful for all the support both during and after the contest. Congratulations to both @Eluned_Morgan & of course @MarkDrakeford on his win. I look forward to working together for Wales. https://t.co/m6L0E8dcMZ— Vaughan Gething AM (@vaughangething) December 6, 2018
Labour Party leader Jeremy Corbyn, who Mr Drakeford had supported during UK Labour leadership elections, said: "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.
Massive congratulations to @MarkDrakeford ! Thank you so much to everyone for all the support over the past few months.— #ElectEluned (@Eluned_Morgan) December 6, 2018
Mr Jones will tender his resignation to the Queen next Tuesday.
Before the result Mr Jones said 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".
Voters in the election were able to 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%.
Just over half - 53.1% - of the circa 25,000 party members voted in the Welsh Labour leadership election.
A total of 5.67% of the around 150,000 members of affiliated groups including trade unions, voted.
What happens next?
- Carwyn Jones resigns next Tuesday by emailing the Queen
- The resignation takes effect when she replies
- 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 AMs.
This is expected to take place next week. Plaid Cymru and Welsh Conservatives are expected to nominate their own leaders - Adam Price and Paul Davies - for the role during the same vote.
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 Mr Drakeford 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."