By Nick Assinder
Political correspondent, BBC News website
Harriet Harman's election as deputy Labour leader came as a genuine surprise and has sent some pretty clear messages to Gordon Brown.
Ms Harman said she felt "privileged and honoured"
The two have worked together before and she made much of their friendship during the campaign.
But she was also one of the most outspoken in her regret over the decision to go to war on Iraq and critical of its prosecution - something she continued during her acceptance speech.
She also often suggested during the campaign that Labour members were looking for a change of emphasis in government policy - and not just on troop withdrawal from Iraq.
She repeated those criticisms in her speech, particularly over government style and the need to abandon spin and media manipulation.
'No John Prescott'
Her victory, therefore, suggests Labour members want not only a woman deputy - something she put at the centre of her campaign and which must not be understated - but also someone who had put clear distance between herself and Tony Blair.
And she is certainly no John Prescott - in what many will see as a good way.
The voting system always had the potential to produce a surprise and, it has to be said, her team were warning right until the end that the contest would not be as clear cut a run-off between Alan Johnson and Hilary Benn as many had been predicting.
DEPUTY LEADER RESULT
1. Harman: 50.4%
2. Johnson: 49.6%
3. Cruddas: Out
4. Benn: Out
5. Hain: Out
6. Blears: Out
The final result comes after eliminated contestants' second preferences reallocated
The breakdown of the vote, which went to five rounds, showed her being the most popular contender among Labour members and second most popular among the party's MPs and MEPs.
She was only fifth in terms of being the first choice of union members - although it was the second choices of those who backed Jon Cruddas (including many union members) which meant she overtook Alan Johnson in that last round.
Some in the party will use the closeness of the result to suggest there was no overwhelming support for her platform, but others will insist she represents the true feelings of the grass roots.
Whether Mr Brown will be as delighted with the result as were many of the delegates at the special conference in Manchester will probably never be known.
He kept his opinions to himself throughout the contest and was only, in the later stages, moved to insist that the policy differences expressed during the campaign would have to cease once it was over.
Now, after the seven-week campaign that never really caught the public imagination, he will have to decide what to do with his deputy.
It has been widely reported that he would not make the new deputy leader deputy prime minister, breaking with John "Old Labour" Prescott's dual role.
Most believe he will abandon the recent tradition of having a deputy prime minister, although there has been speculation he may give large parts of the role, perhaps with a different title, to another loyalist, with the name Jack Straw on many lips.
He dealt swiftly with the decision of whether to give Ms Harman a job in Cabinet, by announcing she would be the new Labour Party chairwoman - thus tasked with the job of rebuilding relations between the party leadership, its activists and the wider British public.
That is no small job. Membership has plummeted to some 180,000 - well short of the million Mr Prescott once set as his target.
Mr Brown now has another set of decisions, however, about what to do with the failed five candidates.
Education secretary and close second place candidate, Alan Johnson, seems certain to keep a senior job in Cabinet. But Mr Brown also has to decide the futures of Hazel Blears, who has just heard her current post as chairwoman is going to Ms Harman, Peter Hain, Hilary Benn and John Cruddas.
All that should become clear in what is certain to be a fascinating Cabinet reshuffle expected later in the week.