A tweet pinned to Sir Ian McKellen’s Twitter account states: “King Lear again.” It is a crisp acknowledgement of his latest tenure in a title role he has performed twice before and reprised as recently as last year. This time, it comes weighted with poignancy after his suggestion that at almost 80, this may be his last big Shakespearean role on stage.

It would make for a perfect swan song if so. There is a sense of an actor putting the finest last touches to his majestic legacy: in McKellen’s incarnation as the arrogant ruler undone by age, infirmity and filial disobedience.

Jonathan Munby’s modern production bears the added weight of being staged in the theatre where McKellen made his West End debut in 1964.

McKellen with Anita-Joy Uwajeh as Cordelia. His performance is infused with compassion. Photograph: Johan Persson

It transfers from a first run at Chichester festival theatre and, in an attempt to keep the intimacy of that original setting, a false wall has been erected, while a ramp runs through the centre to extend the action into the auditorium and reduce the size of the audience to just over 500.

It allows McKellen to play the part with a naturalism that initially seems risky in its illustrious West End context but pays off for its deep melancholic charge.

McKellen’s Lear seems half-absent in the opening scene as he invites his daughters’ praise in return for his kingdom, not with imperious demand but with casual entitlement. The staging speaks his power for him – a large union jack spread across the set, guards nodding their deference and an oversized self-portrait that hangs centre stage, painted in the style of Rembrandt’s last portrait and like it, prefiguring Lear’s end with his face already half in shade.

This is not the declamatory monarch McKellen played in Trevor Nunn’s 2007 production, tearing off his trousers in the histrionics of the heath scene. It is a quickly broken Lear. His lines are spoken softly, stumbled upon, croaked out or interrupted by tears and occasional capers to show his ignominious decline.

McKellen draws out Lear’s signs of dementia – the angry outbursts, the sudden memory blanks – and infuses his performance with such compassion that we feel for this “discarded father” long before his breakdown in the storm.

The play is indeterminately modern in its setting: the dress code is that of a 1930s drawing room, though the army’s camouflage fatigues and guns suggest a more contemporary era. The drama happens in wood-panelled rooms and chandeliered dining halls but props fall away after the storm to open up to a barer stage set and a stark white backdrop on Lear’s arrival to Dover.

The contemporary setting is a perfect fit for the nihilism at the heart of the play in its obsession with being and nothingness and Shakespeare’s subtle and heretical challenge to the biblical concept of a soul.

Lear is both the ancient Celtic king of curses and superstition and the existential antihero, questioning what, if anything, lies at the centre of his being once his worldly titles are stripped away.

The lighting is sleek and cinematic: characters are spotlit for an instant before the stage falls to black again, and the mood is set on edge with sudden bursts of thrillerish music. It gives the production its clarity and pace in the first part – a rare achievement for a play of epic proportions, opaque plotlines and anguished depths.

Oliver Fenwick’s sleek, cinematic lighting heightens the tension in this Shakespearean classic. Photograph: Johan Persson

The filmic elements remain subtle until Gloucester’s eyes are gouged out. A sexually perverse Regan flicks on the radio and dances with voyeuristic delight as Gloucester is tied to a chair and blinded, channelling the seminal scene of violence from Quentin Tarantino’s Reservoir Dogs. It is a heavy-handed cross-reference, and it works, but it changes the tenor of the play, bringing out the dark comedy that has until now remained under the surface.

Kirsty Bushell’s Regan becomes ever more ham as a simpering, hypersexual sadist, while James Corrigan amps up the villainy as Edmund, glinting with malice in conspiratorial soliloquies. Both are entertaining characterisations but have a touch of pantomime.

Whatever its inconsistencies and imperfections, this production still dazzles, McKellen shimmering brightest at its dark, tormented heart.

At the Duke of York’s until 3 November. The play will be broadcast live on 27 September with National Theatre Live.