Jean Trumpington, Lady Trumpington, who has died aged 96, was one of the most recognisable and best known members of the House of Lords, partly because of her long service on the Conservative frontbench but also thanks to her readiness to speak out in a pithy and memorable manner on a huge range of subjects of public interest. But the jocularity for which she was famed disguised a sensitive and thoughtful politician. She also had a remarkable facility for friendships in which age, social status and politics were wholly irrelevant.

As well as being one of the longest continuous serving members of Tory governments in office until 1997, she had a number of claims on historical records. She became the oldest female minister ever at the age of 69 and remained in office until the age of 74, when John Major’s administration fell. She was a hugely popular member of the government Whips’ Office in the Lords, in which she served for a total of seven years and was the longest-serving female whip in either house. Shortly after her 90th birthday, in 2012, she became the oldest panellist to appear on the BBC’s Have I Got News for You.

While she was a junior minister at the Department of Health and Social Security, from 1985 to 1987, she sought to legalise brothels, but her plans were publicised and subsequently scrapped by the prime minister, Margaret Thatcher.

She moved to the then Ministry of Agriculture, Fisheries and Food in 1987, was promoted to minister of state two years later and greatly enjoyed her responsibilities there, particularly because of the overseas travel involved. Returning from the Caribbean on one occasion, she made a personal private present to the Duke of Edinburgh of a small device, which if fitted over a finger and pulled taut could not then be removed. It was called a “wife leader”. When Major asked her to retire from this post in 1992, she admitted unashamedly to her friends later that she had burst into tears. The prime minister patted her on the shoulder and relented.

Facebook Twitter Pinterest Jean Trumpington with the Yeomen of the Guard in the House of Lords. She retired from the house at the age of 95. Photograph: Andrew Parsons/PA

Trumpington cut a formidable figure at a stately 6ft in height and her stentorian voice was weathered by nearly 70 years of cigarette smoking; she started smoking at the age of 10 and gave up at 79. She took her title from the ward she represented as a councillor for 10 years from 1963 on Cambridge city council and for the following two years on Cambridgeshire county council.

As Jean Barker, she was mayor of Cambridge and proud of saving the city’s market square from being turned into a car park. She twice attempted unsuccessfully to secure selection as a Conservative parliamentary candidate, for Cambridge and for the Isle of Ely, before being made a life peer in 1980.

She was born Jean Campbell-Harris, the eldest of three children, into a lifestyle now almost forgotten. Her mother, Doris Robson, was an American heiress and her father, Major Arthur Campbell-Harris, was a Bengal Lancer who had served as an aide to Lord Reading, the viceroy of India, but resigned his commission to work for his wife’s family paint business, until the 1929 financial crash wiped out the fortune.

“One never quite knew whether one was in the money or out of the money,” she said, but the family lifestyle did not greatly change. “My mother’s idea of being poor was going to the Ritz on a bus,” she explained. She was sent to boarding school, and every term before she returned her father would take her to dinner at the Savoy or the Dorchester.

She left school at 15, having never taken an examination. When the second world war broke out, she became a land girl for a year to David Lloyd George, who was a close family friend, on his farm at Churt, Surrey. Jean’s parents were staunch Liberals and had many political friends. She spent a year dealing with apples and pears, which she did not enjoy, and lived in the house belonging to the former prime minister’s mistress and later wife, Frances Stevenson.

Play Video 0:29 Lady Trumpington gives V-sign to fellow peer – archive video

Things looked up, however, when another family friend took her to a cafe in Whitehall, established that she spoke French and German, and signed her up as a cipher clerk at Bletchley Park. She spent the rest of the war typing German naval signals as the team cracked the German U-boat codes.

Dancing the night away in London on 48-hour passes, she told friends as a cover story that her department was responsible for deciding who got medals, which apparently focused the minds of young officers. Her mother scraped together clothing coupons to buy her a dress for the 1941 debutantes’ ball, which she briefly attended but sneaked off to go to the Café de Paris. Minutes before she arrived, it was bombed, killing 80 people.

She had an ability to think fast in any situation. She related how once she was staying in a country house, putting her hair in curlers at her dressing table, when Lord Beaverbrook entered the room, wearing only his pyjama tops. “Oh good,” she said. “I needed a hand. Could you hold these for me please?” She passed him her curling papers, which he dutifully doled out to her, and then when she had finished and thanked him dismissively, he obediently padded out of the room.

In 1945 she canvassed for the Conservative party and then worked for four years in France, helping to restructure the internal transport system. She was secretary to Viscount Hinchingbrooke (Victor Montagu), the Tory MP, from 1950 to 1952 and for the next two years worked in an advertising agency in the US, where she met Alan Barker, a former Eton teacher, who was on a fellowship at Yale. They were married in 1954. As she walked up the aisle, she heard someone say: “What a waist.” She and her husband would always laugh about which way the noun was spelled.

Her husband became head of the Leys school in Cambridge, before moving to University College school, London. On their last day at the Leys, the headteacher’s wife jumped, fully dressed, into the school swimming pool, providing an example that was then exuberantly followed by a number of boys. “Barker,” as she always called her husband, reportedly refused to speak to her for three days. They had a son, Adam, who became a lawyer.

Trumpington was on the board of the Air Transport Users’ Committee, which she chaired from 1978 to 1980. She was on the board of visitors at Pentonville prison from 1975-81 and a member of the Mental Health Review Tribunal. She was a magistrate in Cambridge and Westminster (1972-82).

She loved bridge and horse-racing and was a steward at Folkestone racecourse. On one occasion as a minister she was being shown around a stud when a stallion demonstrated his masculinity, somewhat to the embarrassment of the staff. “It’s all right,” she reassured them. “I’m sure he just knows I used to be a mayor.” She chose the crown jewels as her luxury when she appeared on Desert Island Discs in 1991, in the hope it would enhance her chances of rescue.

Trumpington enjoyed the celebrity of her later years, which included a starring role in a television documentary on fashion for the elderly. She published a ghost-written autobiography, Coming Up Trumps, in 2014 and retired from the House of Lords when she was 95, in 2017. Two weeks before she died, in a ceremony at her Chelsea nursing home, she was invested with the Légion d’Honneur by the French ambassador, Jean-Pierre Jouyet, in recognition of her wartime service.

Her husband died in 1988. She is survived by Adam.

• Jean Alys Trumpington, Lady Trumpington, politician, born 23 October 1922; died 26 November 2018

• This article was corrected on 30 November 2018. Lady Trumpington was 74 rather than 75 when John Major’s administration fell.