Clever, sexy and single-minded, author of some of the best political diaries of her time, she was the most important female politician the Labour movement has yet produced, a unique witness to and participant in the 20th century history of the left.

From the pre-war unity campaign against fascism via the early issues of Tribune to the Bevanites in the 50s, taking in Cyprus and the Hola camps in Kenya,and climaxing in the heart of Harold Wilson's government she was an unflagging champion of an ethical socialism which she believed should shape every aspect of life. She was the leading woman of the left who, in one of the ironies of 20th century politics, paved the way for Margaret Thatcher, the leading woman of the right, to capture the commanding heights of government.

In a political career which began with the miners' lock-outs of the early 1920s and only ended with her death yesterday, she combined a hard-headed pragmatism without compromising a passionate belief in the transforming power of socialism. Her ambition, she said, was 'to inch people towards a more civilised society'. She was brave and determined, the heart throb of the constituency labour parties for nearly 30 years, but her career foundered on an inability to master the key political skill of building support where it counted, in the parliamentary party. She claimed to find making political alliances demeaning; her critics found her wearisomely egocentric. Even her friends distrusted her temper.

The last five years brought her an Indian summer of popular favour as her distaste for Blairism made her the heroine of the same right-wing press which cheered her departure from the Cabinet in 1976.

Barbara Anne Betts grew up in the secure environment of a family with a need for belief. The socialism of the independent labour party was the main, but not the only, religion of the household. Her mother Annie, a Labour councillor, was a devotee of the romantic William Morris; her father, Frank, was a tax inspector, a poetry-writing intellectual who filled the columns of the The Pioneer - the journal of the Independent Labour Party which he edited in the late 1920s and early 30s - with art criticism and politics in equal measure. He nurtured young talent like Vic Feather, thus enabling the future general secretary of the TUC to dismiss Barbara, when she was Secretary of State for Employment and Productivity fighting her doomed battle for trade union reform, as 'a lass he knew when she was still in dirty knickers'.

Although she was never untruthful about her own past, it was rather less proletarian than she would have liked for a party suspicious of middle class intellectuals. She toiled through Bradford girls' grammar school, and followed her older, more brilliant, sister Marjorie to Oxford (there was also a brother, Tristram), where she made the daring choice of sex and practical politics over economics and philosophy. She graduated with a third class degree and a sense of intellectual inadequacy which drove her to work with almost damaging diligence throughout her political career.

Determined to be a journalist and a politician, the Depression forced her briefly to earn a living selling dried fruit from a mobile display in a Manchester store while, in her free time, setting out to save the Labour Party from the betrayal of Ramsay MacDonald's National Government. Soon after Oxford Barbara fell in love with the leading Socialist intellectual and journalist, William Mellor. He was married with a young child, but for more than ten years, they pursued a tempestuous, semi-public affair, their passion spent equally between each other and the politics of the Left. But although she knew of the affair, Mellor could never bring himself to leave his wife. He died, suddenly, in 1942.

Barbara found other friends, notably her immediate junior at Oxford, Michael Foot. Later, Foot happily indicated they shared more than Marx and Dickens in front of the gas fire of a small flat in Bloomsbury, but she angrily denied there had ever been an affair and Foot, professing mild surprise, loyally retracted.

Together, in 1937, they helped launch Tribune, which was edited by Mellor until he fell out with Tribune's financial backer, Sir Stafford Cripps. The paper whose declared mission was to recreate Labour as a truly socialist party, was also Cripps' personal contribution to the left's campaign against rearmament and in favour of a united front against fascism, and it was soon in sustained conflict with the leadership which in turn was increasingly making common cause with the Churchill wing of the Conservative Party. Cripps sent Barbara off to Moscow, from where she reported, without irony, on the new assurance of Russian women in the age of Stalin.

Determined not even war could interrupt her pursuit of a political career, she rejected more exotic offers to became a temporary civil servant while she hunted for a parliamentary seat. In 1943, she made her first speech to party conference, accusing the leadership - accurately - of preparing to compromise on the timing of the implementation of the Beveridge report. "We want jam today, not jam tomorrow," she warned.

It was a popular cry on the Daily Mirror. Its night editor was Ted Castle: he put the story on the front page. After a courtship of proselytising together for Beveridge on street corners and in parish halls, they were married and stayed so, through some rough times, for 34 years.

In 1944, after a mutiny by the women in the party who insisted that at least one woman candidate be interviewed, she was selected for one of the two Blackburn seats, beating three men for a constituency she represented until her retirement from Westminster in 1979.

As soon as she got to Westminster, Sir Stafford Cripps asked her to be one of his parliamentary aides. Attlee notoriously underpromoted young and left-wing politicians, and when Cripps moved on from the Board of Trade to take over as Chancellor, she was left behind to work for his successor, Harold Wilson. She often disapproved of Wilson's rapacious ambition, but it was the start of the most important political relationship in her life. She nominated him for the leadership when he challenged Gaitskell unsuccessfully in 1960 and again when he won, after Gaitskell's death in 1963.

When Labour was finally returned to power in 1964, her reputation was for division within the party and personal vituperation against enemies outside it. Probably the only leader who would still have given her a department to run was her old friend Harold Wilson. He squeezed her into his first cabinet at the Department of Overseas Development - a department whose creation she had often advocated - and gave her the opportunity to reinvent herself, at the age of 53, as one of the most effective Cabinet ministers of her generation.

With no ministerial experience and a department to be chiselled from the stoney faces of the Foreign, Colonial and Commonwealth Offices, she sent her private office staff round to the Fabian Society to collect every available copy of a pamphlet she had written on international development and instructed them to treat it as a blueprint. Within a year, she had successfully established her department and secured its budget, and demonstrated a flair for the photo-opportunity desperately needed by a government already wracked by internal tensions and an economy in crisis.

Wilson promoted her to the Department of Transport (even though she couldn't drive) where her dominant traits as a minister became clearer: she demanded total support from her civil servants ñ in a very public battle of wills, much effort was devoted to trying to move her permanent secretary, Sir Thomas Padmore; she had a good eye for what was both desirable and achievable, and the left's unshakeable belief in the power of government to plan from the centre. In her two and a half years at Transport, she transformed the culture of motoring with the introduction of the breathalyser and the seatbelt.

But with the economy still perilously fragile despite the devaluation of 1966, Labour was locked in its long and ultimately failed attempt to control inflation while maintaining full employment. A pay policy was unavoidable, but equally unpopular.

Wilson wanted Barbara to bring her dynamism and popularity to selling the pay restraint to an increasingly nervous PLP. He created a new department for her, Employment and Productivity. And she was brought into the heart of government as First Secretary, a title generously foregone by another political intimate, Dick Crossman. It was the pinnacle of her career and from it she heroically flung herself, convinced of her own rightness, down into the deep gulley of union reform.

Convinced a statutory pay policy was an instrument of socialism, a brake on the industrial might which won inflationary pay claims at the expense of the economy and of weaker unions, she was brought up short by trade unions which were totally resistant to any restraint on free collective bargaining.

Under pressure from the Tories and wrapped in an unshakeable confidence in the duty of government to bring order to the chaotic state of British industrial relations, Barbara attempted to deliver a socialist solution ("The trouble with Barbara is that she thinks anything she does is socialism," sniffed a contemporary.) In Place of Strife was the inflammatory title of a white paper which proved to be the most divisive attempt at legislation for 35 years. Although there were many worthy proposals intended to strengthen trade unions, all anyone saw were plans for compulsory strike ballots and a cooling off period, both to be underwritten by sanctions. Barbara, who believed she could make anyone love her given time, wanted a long evangelical campaign to build up popular support. Roy Jenkins, the Chancellor, was desperate for some reassuring morsel to feed the bankers hungrily circling the floundering pound. She was forced to accept a short bill to enact only the penal clauses.

In the face of a campaign illuminated by the startling duplicity of senior colleagues, including the then Home Secretary, James Callaghan, and an entirely hubristic challenge from the unions, pathfinding for the Thatcher assault on trade union rights ten years later, Barbara and Wilson rashly made the legislation an issue of confidence.

Egged on by an enthusiastic press (with the exception of the Guardian) Barbara took the battle to seaside resorts and spa towns around the country in a dramatic and hugely popular appeal to individual union conferences. In barrister's black, the taut passionate figure aroused the admiration of millions. But trade unionists, led by Vic Feather at the TUC , found her ignorant, inflexible and hectoring. Friends on the left could not understand why she was doing the Tories' work for them. And Wilson's more ambitious enemies - of whom there were many if never quite as many as he thought - planned for what they were sure was his imminent downfall.

There were genuine fears the party could be split into union-sponsored and independent MPs, another 1931. The Cabinet - ultimately even the chancellor - deserted the bill. Wilson and Barbara were forced into humiliating defeat behind a fig leaf "solemn and binding" agreement that the TUC and the unions would work together to try to restrain the unofficial strikes which were undermining economic recovery.

Barbara's stock crashed to earth. But the ramifications went far beyond personal disaster. The episode accelerated a renewed alienation between party activists and the leadership. Local parties became vulnerable to infiltration by Trotskyite groups like Militant preaching the politics of betrayal. The leadership of the left - never quite within Barbara's grasp - was now torn between Michael Foot and Tony Benn.

The unions, after Edward Heath's failed attempt at union legislation which was uncomfortably close to Barbaraís own, agreed the social contract, a promise of voluntary pay restraint in return for legislative favours from a future Labour government.

Back in power in 1974, Wilson loyally put Barbara - who had been thrown off the elected shadow cabinet in 1972 - into the Department of Health and Social Security. Here, in a period of government often overlooked, she launched a last effort to push back the frontiers of the welfare state.

But although it was marked by notable achievements like the introduction of Serps, the scheme for second pensions which was intended to transform the old age of millions of low-paid, she squandered her last political capital on an ideological battle over pay beds in the NHS. This time, the backbenches and the unions cheered her on. But it was at a heavy cost to the health service: at one stage all hospital doctors, from the most junior to the most senior, were involved in industrial action which closed accident and emergency wings and tainted industrial relations for years afterwards. Before she could bring in the legislation for which she had fought so hard, Wilson resigned. His successor, Jim Callaghan, sacked her with unexpected brutality and her pay bed reforms ran slowly into the sand. By 1979 only a quarter of all paybeds were phased out, while the private sector outside hospitals blossomed unrestrained.

There were other, more subtly achieved and lasting successes. Although she always rejected single issue politics as a distraction from socialism (like Margaret Thatcher, she was a politician who was also a woman - tough, flirtatious, vain, often hot tempered, capable of tears in moments of drama - rather than a woman politician) and she brutally dismissed recent attempts to make Westminster a kinder, gentler place, her most enduring achievements came on behalf of women. Equal pay was the most notable, slipped past a reluctant Roy Jenkins in a late night bid in 1970 to avert a backbench revolt. She won other vital concessions for women in pensions reforms. She introduced child benefit and insisted it went into the purse not the wallet.

Even when she gave up the Commons in 1979, she could not give up politics. After a lifetime's opposition to the European Union, she became the leader of the Labour group in the European parliament where for another ten years she harried commissioners on the Common Agriculture Policy before finally demanding a seat in the Lords of the then Labour leader Neil Kinnock. She remained an active and determined campaigner for pension rights (the Chancellor, Gordon Brown called her 'my mentor and my tormentor') and against animal cruelty until her final illness.

Her passion for politics was given full rein in her final incarnation as national treasure. As the figurehead and part-inspiration for the 1990s campaign to restore the link between pensions and earnings which she had introduced 20 years earlier, she finally won the near-universal applause of which she had so long dreamed.

Committed to the socialism of her youth, she hated what she thought Tony Blair was doing to the party. But her loyalty to the Labour movement was unfaltering. And contemporaries, infuriated by her single-minded and relentless pursuit of her objectives in government, recalled in the cosy glow of nostalgia her huge appetite both for life and for the fight, a woman who delighted in dancing with the enemy at night before spearing him with her invective the next day.

She and Ted, who died in 1979, had no children, but were devoted to their nieces and great nieces and nephews.

Barbara Anne Castle (Baroness Castle of Blackburn), born October 6 1910; died May 3rd 2001

Anne Perkins' biography of Barbara Castle will be published in autumn 2003