The Marvel “X-Men” movie franchise has been an up-and-down affair. The initial trilogy of 2000-2006 was a financial smash, but the quality wasn’t terribly high, and the third episode, “The Last Stand”—directed by Brett Ratner, who took over from Bryan Singer (“X-Men” and “X-Men United”)—was the nadir. That was followed by an awful “Wolverine” spinoff in 2009 (a further installment devoted to him in 2013 was better, but not by much). More importantly, Matthew Vaughn rejuvenated the series with the excellent “First Class” in 2011, and Singer returned at the top of his form with “Days of Future Past” two years ago. Now Singer follows that up with a finale to the second trilogy that doesn’t quite match its immediate predecessors, but is still a solid entry in the superhero sweepstakes.

The strength of “X-Men: Apocalypse” doesn’t lie, frankly, in the story, which has been adapted by Simon Kinberg from one of the comic’s basic threads. It centers on Apocalypse (Oscar Isaac), an early mutant—often referred to as the first of his kind—who survived over generations by periodically taking over the bodies of younger men. We meet him in ancient Egypt, where as En Sabah Nur he’s been lording it over the Nile and is now about to undergo another such transformation. There’s a conspiracy against him, however, which buries him under tons of stone just after the change has been accomplished.

In the mid-eighties, a clutch of devotees—along with unwitting CIA agent Moira MacTaggert (Rose Byrne)—resuscitate Apocalypse, who looks over Cairo and quickly concludes that the human species must be wiped out so that the earth can begin afresh. To do so, he recruits three followers—needy Ororo (Alexandra Shipp), hot-tempered Psylocke (Olivia Munn) and depressed Angel (Ben Hardy)—to serve him. Eventually added to their number is Erik Lensherr, aka Magneto (Michael Fassbender), who’s been living incognito as a simple Polish workman with a wife and a lovely daughter until his neighbors incite a family tragedy that sends him to the dark side again.

Arrayed against them will be a variety of X-men, some old and some new (or at least reintroduced in younger form). Foremost among them, of course, is Professor Xavier (James McAvoy), now wheelchair bound, who runs the school for mutants who wish to assimilate, and who, along with his trusted lieutenant Hank McCoy, aka Beast (Nicholas Hoult), is attempting to train the young Jane Grey (Sophie Turner) to control her telekinetic powers. They will be joined in due course by loner Raven, aka Mystique (Jennifer Lawrence), who escorts a new recruit, the young Nightcrawler (Kodi Smit-McPhee); she’s saved him from a European fight club where he’d been pitted against Angel. Another newcomer is Scott Summers, aka Cyclops (Tye Sheridan), brought to the school by his brother Alex, aka Havok (Lucas Till) when his eye-blasts emerge uncontrollably. Another youngster will eventually show up on his own—Peter Maximoff, aka Quicksilver (Evan Peters), who has a secret about his family background. And when some of our heroes fall under the control of uncomprehending military men, they get a bit of help from a surprise guest star fans will greet enthusiastically.

What follows isn’t much more than a battle between the two sides in which Apocalypse attempts to take over Xavier’s body and use his powers to unleash nuclear devastation on both sides of the Cold War while the X-men, old and new, work to prevent him from succeeding; Magneto, as usual, is the man in the middle, struggling between his friend Xavier’s invitation to join the forces of good and Apocalypse’s cultivation of his personal fury, and there are plenty of obstacles to overcome along the way. It all ends, of course, in a cataclysmic fight to the finish.

But if the substance isn’t all that remarkable (though Isaac is an excellent actor, for example, encased in makeup he can’t make Apocalypse much more than a gloomy statue), the construction is. Singer, working closely with Kinberg, cinematographer Newton Thomas Sigel, editors John Ottman and Michael Louis Hill and effects master John Dykstra, keeps the narrative both clear and fast-moving. He knows how to make films like this, however complicated they are and however many characters he must juggle, unfold smoothly, and in an era when simple coherence and good craftsmanship are becoming increasingly rare commodities in these franchise blockbusters, his pictures—even a goofy one like “Jack the Giant Killer”—demonstrate precisely those virtues. Ottman also provides a solid score that plugs in snatches of Beethoven’s Seventh Symphony at a few moments.

In films of this sort fine acting is hardly dominant, but all the returning stars acquit themselves well, with Fassbender again the standout as the conflicted Magneto. The newcomers are excellent too, with Sheridan and Smit-McPhee especially winning. But as in the last go-round, it’s Peters who takes the honors, adding a touch of over-the-top kookiness to Quicksilver that sets that character apart.

There are a few miscalculations in “Apocalypse,” the worst being the use of Auschwitz as a plot device—a decision that will strike many as tasteless. More might have been made of the political situation in the mid-eighties, too; the period trappings are mostly of a cheerfully inconsequential sort, though one—involving another cinematic trilogy—provides the movie’s biggest laugh (even if some viewers might think it hits too close to home). And as enjoyable as the elaborate sequence showcasing Quicksilver’s arrival at Xavier’s academy is, it is awfully reminiscent of the one in the previous film in which his speed saved the day.

Still, by the standards of the genre this is mostly a first-rate job, in this viewer’s estimation the best of the superhero flicks to appear thus far this summer.