Vast country houses built for leisure and the display of status must adapt to the demands of a new age – or die. And if ever there was a house and estate that exemplified the importance of adaptation it is Chatsworth House, the Duke of Devonshire's baroque jewel in north Derbyshire. Now open to hordes of paying visitors, with shops and cafes, Chatsworth is big business, having successfully rebranded itself (to use modern terminology for old-fashioned pragmatism) as a heritage experience, a visible symbol of the continuity of the past alongside the new demands of the present.

Roy Hattersley's new book about the Cavendishes (they were made earls of Devonshire and received a dukedom in 1694) is a chronicle of a family that has managed to pull off the trick of appearing to be the guardian of a monolithic and unchanging aristocracy while at the same time embracing the changes of each century with gusto. Hattersley makes no claim to be unearthing anything new in a well-trodden family history but his confident mastery of the historical scope of English political life, his feeling for the topography of the Peak District and his grasp of the tangled ambitions of the early Cavendishes make this book a vivid read, crowded with characters and colour. Hattersley is interested less in the aristocracy in the golden age of their triumph but in the greed, ambition and social climbing that got them there in the first place – and about the myths that are then spun to consolidate their position and to secure it for their descendants.

The Cavendishes owe their position in Derbyshire to the redoubtable Bess of Hardwick, daughter of a yeoman farmer who married in 1547, as the second of her four husbands, Sir William Cavendish, a court bureaucrat, auditor, lawyer and assiduous fixer who managed to survive almost unscathed, "offices and prestige intact", the religious and political vicissitudes of four Tudor reigns, including an association with Thomas Cromwell and a dangerous allegiance with the family of Lady Jane Grey. Having profited handsomely from the Dissolution, Cavendish hastily baptised his latest child a Catholic when Mary I came to the throne. What Hattersley calls Cavendish's "ruthless ambition and flexible principles" and his wife Bess's similarly powerful dynastic aspirations and massive acquisition of land and property laid the foundations of a dynasty. The couple were formidably proficient at both accumulating money and spending it – and in 1549, they snapped up the manor of Chatsworth for a knockdown price. "Building Bess" then set about dredging and draining the landscape and started work on the erection of an enormous house, the beginning of a project that was to preoccupy her descendants for generations.

Hattersley's narrative goes at a clip, though from Bess of Hardwick on, the Cavendishes were so entangled with the public life of the court and government that inevitably there is some filling in of background and going over familiar ground. The family have had their share of drunks and dissolutes and some heroically extravagant big spenders. From early on, they were at the heart of Whig politics: a Devonshire was one of the "immortal seven" who invited King William of Orange to take the throne; the notorious Devonshire House Circle, presided over by Georgiana, wife of the fifth duke, was at the very centre of 18th-century political intrigues. For five centuries, the Devonshires have been central to the big political scene, both influential behind the curtain and in the spotlight, centre stage.

When in retirement from London political life, successive dukes tinkered endlessly with Chatsworth, making it grander, extending it, further modifying the landscape to enhance the beauties of the house.

But it is to the sixth duke, "the Bachelor Duke" and his inspirational head gardener, Joseph Paxton, that we owe the Chatsworth of today. Their innovations ushered in a new age of splendour, making the house and grounds a glorious showcase for an age of travel, science, discovery and engineering. It was the seventh duke, however, who "dragged that ancient family into the modern world" by investing in steelworks, shipbuilding and railways and creating from a small town in Cumbria called Barrow-in-Furness a centre of industrial expansion.

The Devonshires' taste for luxury survived periods of terrible debt – and they continued to live in a state which often seemed at odds with the age. Their footmen were still performing the 18th-century practice of powdering their hair into the 1920s.

Hattersley's rollicking history illuminates a dynasty marked by all the contradictions of aristocratic entitlement – of both public service and ruthless pragmatism, of complacent noblesse oblige and an appetite for the new. In a sense therefore, theirs is the story of modern Britain.