Today’s election for a new Deputy Leader of the Labour party was the closest since 1981.
In the fifth and final round of voting, Ms Harman took the lead with 50.43% to Alan Johnson’s 49.56%
She was overtaken by Alan Johnson until the last round, and it is thought many Jon Cruddas voters gave support to her.
Hazel Blears was the first candidate to be eliminated, followed by Northern Ireland Secretary Peter Hain.
Hilary Benn, the International Development Secretary who was seen as a frontrunner, lost the third round.
Backbench candidate Jon Cruddas had a strong showing, getting 30.06% in the fourth round, with Harman on 33.58% and Alan Johnson on 36.35%
In the fifth and final round, Ms Harman beat Mr Johnson by 0.87%
In 1981, Tony Benn, whose son Hilary was knocked out in the third round, was beaten by Denis Healey in the second round of voting for Deputy Leader 50.4% to 49.6%
In her acceptance speech, Ms Harman reminded party members of the achievements of the last ten years of a Labour government – the NHS reforms, the national minimum wage and education, civil partnerships, international aid.
“Britain is better, fairer and more prosperous,” she told party members at a special conference in Manchester.
Ms Harman, currently a Justice minister, is seen as close to the incoming Prime Minister.
She paid tribute to former Labour leader Neil Kinnock for his support, and described herself, Gordon Brown and Tony Blair as ‘Neil’s apprentices.’
Gordon Brown was also declared Leader of the Labour party at the conference.
Tony Blair remains Prime Minister until Wednesday. He will give a farewell performance at Prime Minister’s Questions before going to see the Queen and resign.
Gordon Brown will then be asked by the Queen to form a government. Details of Mr Brown’s first Cabinet will be revealed throughout Thursday.
Ms Harman’s victory was a surprise result – Education Secretary Alan Johnson was tipped to win.
It is reported that Gordon Brown will not be appointing her Deputy Prime Minister.
The party used an electoral college to elect the Deputy Leader, split three ways between the MPs and MEPs, the party membership and members of affiliated unions and socialist societies.
As no candidate got 50% or more of the vote outright, further elimination ballots were held.
In the fifth round, Ms Harman got 15.42% of MPs and MEPs, 18.83% of party members and 16.18% of votes from the affiliated trade unions and socialist societies, totalling 50.43%
Mr Johnson got 17.91% of MPs and MEPs, 14.50% of members and 17.15% of the affiliates and societies, totalling 49.56%