At the age of 35, James Graham is currently Britain's busiest playwright. With his new play Labour of Love, he continues to stake his claim to be one of its very best.

As its title suggests, this is both a history of the Labour party and a love story. It is a heartfelt political analysis and a laugh-till-you-cry West End comedy. It is a balancing act of considerable sophistication and skill – and it is absolutely wonderful.

It begins in the constituency office of David Lyons (Martin Freeman), Labour MP for a North Nottinghamshire constituency who, against the Corbyn tide which deprived Theresa May of her parliamentary inspired majority, is about to lose the seat he has held for 27 years. His only companion is his agent Jean (Tamsin Greig) who is alternately baffled ("I don't know who's sticking what where anymore"), and consoling ("think of all the things you hate about being an MP").

The mood is melancholy but the tone is not. It is in fact startlingly funny, peppered with one-liners and jokes, as well as a touching moment when Greig hugs her flipchart, overwhelmed by affection. But the themes of what is to follow are laid out: Jean is an instinctive left-winger, David is a pragmatic Blairite. The relationship between them seems compellingly real, built in long-years of bickering and self-knowledge.

Then suddenly, David's estranged wife Elizabeth (Rachel Stirling) arrives and drops a bombshell – and with equal suddenness we spool back in time to significant moments in the history of David's life and of the Labour party, ending up with his idealistic arrival in post in 1990. The transition is achieved by the help of clever adjustments to Lee Newby's cluttered office set (each election poster carefully displayed on the wall) and Duncan McLean's video projections which remind us of the news footage and the speeches of the era we are travelling through.

Because time is rolling backwards, Graham has great fun with our knowledge of the future. The magnitude of David's defeat is laid bare by the way in which at different points different characters refer to the fact that "a lemon", "a tub of cottage cheese" and a "sausage sandwich" could hold the constituency provided it represented Labour. He also crafts a series of brilliant comic moments. One featuring identical aerosol cans and a singing snowman is worthy of Alan Ayckbourn at his very best.

But by the interval – the play runs to just under three hours – you might be forgiven for thinking that it is a clever farce, but not that much has been revealed either about the state of politics or of the heart. It's in the second half, when the same scenes are continued but now unfold forwards that Graham pulls off his masterstroke.

Throughout he reveals his ability to put political debate into the mouths of characters, to make it feel real. Now passions rise and the arguments become more complex; one attack by Dickon Tyrrell's Len, council leader and standard bearer of the principled left, gets to the heart of many of the dilemmas and doubts that have dogged Labour through 100 years of history. But what makes it work dramatically is that it is so deeply embedded in the hidden love story that is developing between David and Jean, a complex web of admiration and antagonism that mirrors the arguments in the party.

In comparison with Graham's other successes, This House and Ink, the play perhaps suffers from its concentration on the tribal politics of Labour rather than the currents of a broader spectrum. But its tale of affection is transformative: it changes the play from political diatribe into a deeply felt and deeply moving depiction of the way that caring for someone changes a life.

Under Jeremy Herrin's graceful direction, Freeman and Greig are magnificent. He is a terrific listener; his passive absorption of the abuse thrown at him and his well-meaning attempts to make everything right make Lyons a sympathetic and rounded figure. The scene where he dances is a joy. But Greig, who only stepped into the role when Sarah Lancashire had to withdraw through illness, is simply extraordinary. She combines almost perfect comic timing with an ability to appear entirely natural on stage. Her ability to convey suppressed but profound feeling is incredibly powerful.

I saw Labour of Love, a co-production between the Michael Grandage Company and Headlong, with two teenagers. We all emerged from the theatre punching the air; there is something exhilarating about its energy and its passion. There are £10 day seats available. They will be worth the queue.

Labour of Love runs at the Noel Coward Theatre until 2 December.