Angels in America is like the great American novel and it is no coincidence that playwright Tony Kushner's favourite writer is Herman Melville, another purveyor of massive, mythical surveys of national life. Not every chapter, every word or every imaginative leap works perfectly – but the scope and vision are enough to make you gasp and cheer.

Subtitled "a gay fantasia on national themes", over two sprawling plays – separately titled Millennium Approaches and Perestroika – lasting a combined total of nearly eight hours, Kushner sets his massive canvas in the mid 1980s, at the moment when the AIDS epidemic was wiping out huge numbers of young, gay men and the politicians of the Reagan era were closing their eyes to the consequences and impact of this modern plague.

Seeing it now, in Marianne Elliott's blistering production, which brings the saga back to the National for the first time since its premiere in 1992-3, is like a vigorously entertaining history lesson. Brilliantly performed by a cast led by Andrew Garfield and Nathan Lane, it is a reminder of just how terrifying and tragic the times were, of all the people who died terribly and needlessly, but also a vibrant hymn to the ragged soul of humanity itself, in all its messy, complicated imperfection.

It begins with a funeral and ends with a plea for life. In between it focuses on three interlinked stories. The central one involves Prior Walter (Garfield), who knows he is dying of AIDS. "Look at the wine dark kiss of the Angel of death," he says, with precise emphasis as he discovers the tell-tale black lesion on his skin. His lover, Louis (James McArdle), a garrulous Jewish filing clerk, is unable to cope with the discovery. "I believe in the Hegelian sense of progress," he mutters. Illness is not part of the plan.

Their lives become entangled with those of Joe, a Mormon lawyer who is fighting the discovery of his own homosexuality (Russell Tovey) and his valium-popping wife (Denise Gough) Harper, whose unhappiness pulls her into a parallel world of revelation. At the heart of it all is the real figure of Roy M Cohn (Nathan Lane), ferocious, crooked lawyer, right-arm of Joe McCarthy, a man responsible – or so he claimed – for sending Ethel Rosenberg to the electric chair, persecutor of "commies and homos" who is now himself dying of AIDS, while claiming he has liver cancer. The fact that this almost biblically corrosive figure was also Donald Trump's lawyer lends a juddering jolt of relevance to the play's themes about hypocrisy, acceptance and the monstering of the other.

The plays, stalked by ghosts and angels, are consistently and savagely funny. Even at moments of agony, Kushner finds humour. When an angel drops through Prior's ceiling at the end of Millennium Approaches, he may be afraid for his life, but he manages to gasp "Very Steven Spielberg" at the same moment. They are also tender. The scene when Cohn, who appears to be dying, tricks the ghost of Rosenberg into singing to him, is a magnificent moment of knock-about comedy; when he actually dies and she and Louis recite the Kaddish over his body, a character who has been shown to be morally poisoned, is accorded dignity and compassion.

Scene after wonderful scene could be taught (and no doubt is) as a lesson in making a drama out of an unlikely setting; the one where Harper and Prior sit in front of a Mormon diorama that comes to life is a dazzling mixture of the humorous and the heart-felt; another where Louis outlines his beliefs on racism to the disbelieving black nurse Belize, (the play's most attractive character perfectly embodied by Nathan Stewart-Jarrett), is a bubbling duologue of incomprehension.

Kushner's achievement is to make his characters so compelling that the massive themes he pins around them - the relationship between man and God, the power of the numinous, the root of good and moral in a shifting, dangerous world, the role of progress and change – sit comfortably alongside the unfolding of their stories.

Elliott holds it all together with a firm but gentle hand, marking the shift from the comparative realism of the first play to the operative sweep of the second with confidence. As befits the director of War Horse, her Angel is not a glossy, white-robed creation but a frightening figure embodied by Amanda Lawrence surrounded by dark puppeteers who move her massive wings. Ian McNeill's set, although occasionally too detailed for my taste (too many lamps, too many lights in heaven), is hugely effective, moving fluorescent-rimmed trucks into view, so scene floats into scene with ease.

The entire cast are just superb. Lane vigorously endows Cohn with enough charisma, making him a blazing force. You are charmed by his energy - "it was never the money, it was the moxie", he explains – even as you are repelled by his moral emptiness. As Louis, McArdle entirely convinces in his sense of inadequacy in the face of his greatest test; his long, agonised speeches, fluidly written, flexibly spoken are among the best of the night. Tovey catches perfectly each mood along Joe's tortured course; Gough, the catch in her voice as subtle as her performance, rends the heart as the lost Harper. Among the supporting cast, Susan Brown's multiple turns as male characters and her final incarnation as a Mormon mother are all utterly truthful.

And Garfield is superb. It is hard to embody this model of high camp, but he brings Prior to full, biting life, never hitting a wrong note, inviting our sympathy but not our pity, and constantly emphasising the character's gallant, open-eyed courage in the face of odds that are always stacked against him. It is an extraordinary, humane performance at the centre of this great epic play. The National deserves enormous credit for bringing it back to the stage with such conviction and power.

Angels in America runs at the National Theatre until 19 August.