Here’s a summer blockbuster that’s actually worth the price of popcorn, and with “Thor” it makes the score two for two for the Marvel canon this season. But “X-Men: First Class” actually has a harder row to hoe than the Norse god did. The franchise had already gone through three regular installments, the last a bust, and one prequel of sorts (the dreadful “Wolverine”). So what was needed was a complete reboot—not as easy a task as Kenneth Branagh faced in starting from scratch—and this second prequel, which takes things back to the origin only hinted at sporadically in the previous pictures, is as successful in that respect as J.J. Abrams’ “Star Trek” was in restarting that long-moribund series. In fact, it’s the best “X-Men” picture of them all.

The winning formula has to be credited primarily to a tight, clever script fashioned by a quartet of writers (including director Matthew Vaughn) from a story by Sheldon Turner and producer Bryan Singer (who helmed the first two “X-Men” features, as well as the most criminally underrated of all superhero movies, “Superman Returns”). It sets the formation of the first X-Men squad in the 1960s against the backdrop of the Cuban Missile Crisis, while also explaining the beginning of the hot-and-cold relationship between the heroic Dr. Xavier and the villain Magneto. The result toys with history, without question, but does so in a way comic fans can appreciate, while providing a sufficient emotional floor to support the action.

But the outcome also has to recognize Vaughn’s astute, economical direction, which hits all the major points squarely while bringing the picture in at a running-time that may be over two hours but doesn’t feel a minute too long, and a cast that actually manages to invest the essentially one-dimensional characters with some welcome layers. Michael Fassbinder plays Erik, the Future Magneto, whom the script introduces as a boy (Bill Milner) being interned in 1942, along with his mother, in a German concentration camp. An evil doctor named Schmidt (Kevin Bacon) recognizes his mutant powers and uses diabolical means to develop them. Meanwhile rich telepath Charles Xavier (James McAvoy), having adopted shapeshifter Raven (Jennifer Lawrence) as his sister, has become an expert on mutants and is called in by the CIA when Agent MacTaggert (Rose Byrne) infiltrates the suspicious Hellfire Club, only to find that it’s a dangerous outfit led by Sebastian Shaw (Bacon’s nefarious doctor, now Americanized and revealed as a powerful mutant who can absorb energy and use it as a weapon) and peopled by his cadre of powerful underlings, which includes the telepath Emma Frost (January Jones), the demon-like Azazel (Jason Flemyng) and the tornado-like Riptide (Alex Gonzalez).

It’s when Xavier helps the government track down Shaw that he meets Erik, who’s also been searching for the death-camp villain to exact revenge on him. They join forces to assemble their own crew of young mutants to confront Shaw and his group. In addition to Raven, rechristened Mystique, they include science expert Hank McCoy (Nicholas Hoult), who becomes Beast; energy-tosser Alex Summers (Lucas Till), aka Havok; supersonic screamer Sean Cassidy (Caleb Landry Jones), renamed Banshee; exotic dancer Angel Salvadore (Zoe Kravitz), who actually has wings; and form-adapter Amando Munoz (Edi Gathegi), known as Darwin. The two sides eventually face off near the Cuban coast during the missile crisis, which Shaw has manufactured as a means of bringing about a nuclear war that will destroy humanity and usher in the rule of his superior mutants. It’s Erik’s ultimate embrace of Shaw’s belief that ordinary humans will necessarily seek to destroy mutants and Xavier’s that the two can coexist that lead to a climactic rupture between the two that explains the professor’s future disability.

Purists will eagerly point out, and probably complain about, the movie’s liberties with the X-Men’s canonical comic narrative, altering characters significantly and even inventing some new ones. But in fact the writing team have expertly sewn together bits and pieces of the Marvel mythology and their own additions into a compact, coherent whole that includes periodic throw-away bits of humor for the fan base. Vaughn has transferred it to the screen in a sleek, stylish package that makes a fine showcase for Chris Seagers’ expert production design, Jon Frankish and Dawn Swiderski’s equally slick art direction, Sonja Klaus’s elaborate sets and Sammy Sheldon’s splendid costumes, all set off by John Mathiesen’s crisp widescreen cinematography (which, thankfully, isn’t compromised by extraneous 3-D technology).

Vaughn conjures up some excellent action set-pieces—an assault on Shaw’s boat, an attack on the mutants’ CIA home, the final sea confrontation—which are only occasionally undermined by some less-than-perfect special effects (a shot of Shaw’s submarine crashing onto the Cuban coast, for instance, is as unconvincing as the avalanches were in “Inception”). And Henry Jackman’s score is supportive without becoming bombastically intrusive.

But all the behind-the-camera work would count for little if the acting let it down. Happily, the performers are uniformly excellent, led by McAvoy’s attractive, ingratiating Xavier and Fassbender’s suitably intense Erik. The supporting cast all fill the bill, with even Bacon reining in what could easily have descended into pure ham as the wicked Shaw.

The result is “First Class” in all respects virtually all the way, as much a triumph for Vaughn in the “straight” superhero genre as “Kick Ass” was in its quirkier send-up vein. As happens so often in the resurrection storylines of superhero comics, he’s truly given the “X-Men” franchise a new lease on life.